Commit 9482abe16f421ecfa23b56e6c2e943ab07540781

Authored by Jürgen Knödlseder
1 parent 821c6a4e

Move execute() method to ctool base class and add pure virtual clear(), run() an…

…d scave() methods to ctool interface. Add read_ahead() method to handle reading of task parameters at the beginning of the task execution. Remove all m_read_ahead members from the derived classes.
pyext/ctbin.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GObservations& obs(void) const; 50 const GObservations& obs(void) const;
pyext/ctbkgcube.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GCTAEventCube& cube(void) const; 50 const GCTAEventCube& cube(void) const;
pyext/ctcubemask.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GObservations& obs(void) const; 50 const GObservations& obs(void) const;
pyext/ctexpcube.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GCTAExposure& expcube(void) const; 50 const GCTAExposure& expcube(void) const;
pyext/ctlike.i
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 /***********************************************************************//** 32 /***********************************************************************//**
33 * @class ctlike 33 * @class ctlike
34 * 34 *
35 - * @brief CTA maximum likelihood tool Python interface 35 + * @brief Maximum likelihood fitting tool
36 ***************************************************************************/ 36 ***************************************************************************/
37 class ctlike : public ctool { 37 class ctlike : public ctool {
38 public: 38 public:
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GObservations& obs(void) const; 50 const GObservations& obs(void) const;
pyext/ctmodel.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GObservations& obs(void) const; 50 const GObservations& obs(void) const;
pyext/ctobssim.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GObservations& obs(void) const; 50 const GObservations& obs(void) const;
pyext/ctool.i
@@ -44,5 +44,11 @@ public: @@ -44,5 +44,11 @@ public:
44 ctool(const ctool& app); 44 ctool(const ctool& app);
45 virtual ~ctool(void); 45 virtual ~ctool(void);
46 46
47 - // Methods 47 + // Pure virtual methods
  48 + virtual void clear(void) = 0;
  49 + virtual void run(void) = 0;
  50 + virtual void save(void) = 0;
  51 +
  52 + // Public methods
  53 + virtual void execute(void);
48 }; 54 };
pyext/ctpsfcube.i
@@ -46,7 +46,6 @@ public: @@ -46,7 +46,6 @@ public:
46 46
47 // Methods 47 // Methods
48 void clear(void); 48 void clear(void);
49 - void execute(void);  
50 void run(void); 49 void run(void);
51 void save(void); 50 void save(void);
52 const GCTAMeanPsf& psfcube(void) const; 51 const GCTAMeanPsf& psfcube(void) const;
pyext/ctselect.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GObservations& obs(void) const; 50 const GObservations& obs(void) const;
pyext/ctskymap.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GSkymap& map(void) const; 50 const GSkymap& map(void) const;
pyext/cttsmap.i
@@ -45,7 +45,6 @@ public: @@ -45,7 +45,6 @@ public:
45 45
46 // Methods 46 // Methods
47 void clear(void); 47 void clear(void);
48 - void execute(void);  
49 void run(void); 48 void run(void);
50 void save(void); 49 void save(void);
51 const GObservations& obs(void) const; 50 const GObservations& obs(void) const;
src/ctbin/ctbin.cpp
@@ -192,31 +192,6 @@ void ctbin::clear(void) @@ -192,31 +192,6 @@ void ctbin::clear(void)
192 192
193 193
194 /***********************************************************************//** 194 /***********************************************************************//**
195 - * @brief Execute application  
196 - *  
197 - * This is the main execution method of the ctbin class. It is invoked when  
198 - * the executable is called from command line.  
199 - *  
200 - * The method reads the task parameters, bins the event list(s) into counts  
201 - * map(s), and writes the results into FITS files on disk.  
202 - ***************************************************************************/  
203 -void ctbin::execute(void)  
204 -{  
205 - // Signal that some parameters should be read ahead  
206 - m_read_ahead = true;  
207 -  
208 - // Bin the event data  
209 - run();  
210 -  
211 - // Save the counts map into FITS file  
212 - save();  
213 -  
214 - // Return  
215 - return;  
216 -}  
217 -  
218 -  
219 -/***********************************************************************//**  
220 * @brief Bin the event data 195 * @brief Bin the event data
221 * 196 *
222 * This method loops over all observations found in the observation conatiner 197 * This method loops over all observations found in the observation conatiner
@@ -371,16 +346,12 @@ void ctbin::init_members(void) @@ -371,16 +346,12 @@ void ctbin::init_members(void)
371 346
372 // Initialise protected members 347 // Initialise protected members
373 m_obs.clear(); 348 m_obs.clear();
374 - m_read_ahead = false;  
375 m_cube.clear(); 349 m_cube.clear();
376 m_ebounds.clear(); 350 m_ebounds.clear();
377 m_gti.clear(); 351 m_gti.clear();
378 m_ontime = 0.0; 352 m_ontime = 0.0;
379 m_livetime = 0.0; 353 m_livetime = 0.0;
380 354
381 - // Set logger properties  
382 - log.date(true);  
383 -  
384 // Return 355 // Return
385 return; 356 return;
386 } 357 }
@@ -407,7 +378,6 @@ void ctbin::copy_members(const ctbin& app) @@ -407,7 +378,6 @@ void ctbin::copy_members(const ctbin& app)
407 378
408 // Copy protected members 379 // Copy protected members
409 m_obs = app.m_obs; 380 m_obs = app.m_obs;
410 - m_read_ahead = app.m_read_ahead;  
411 m_cube = app.m_cube; 381 m_cube = app.m_cube;
412 m_ebounds = app.m_ebounds; 382 m_ebounds = app.m_ebounds;
413 m_gti = app.m_gti; 383 m_gti = app.m_gti;
@@ -491,7 +461,7 @@ void ctbin::get_parameters(void) @@ -491,7 +461,7 @@ void ctbin::get_parameters(void)
491 461
492 // Optionally read ahead parameters so that they get correctly 462 // Optionally read ahead parameters so that they get correctly
493 // dumped into the log file 463 // dumped into the log file
494 - if (m_read_ahead) { 464 + if (read_ahead()) {
495 m_outfile = (*this)["outfile"].filename(); 465 m_outfile = (*this)["outfile"].filename();
496 } 466 }
497 467
src/ctbin/ctbin.hpp
@@ -75,7 +75,6 @@ public: @@ -75,7 +75,6 @@ public:
75 75
76 // Methods 76 // Methods
77 void clear(void); 77 void clear(void);
78 - void execute(void);  
79 void run(void); 78 void run(void);
80 void save(void); 79 void save(void);
81 const GObservations& obs(void) const; 80 const GObservations& obs(void) const;
@@ -105,7 +104,6 @@ protected: @@ -105,7 +104,6 @@ protected:
105 104
106 // Protected members 105 // Protected members
107 GObservations m_obs; //!< Observation container 106 GObservations m_obs; //!< Observation container
108 - bool m_read_ahead; //!< Read ahead parameters  
109 GSkymap m_cube; //!< Event cube 107 GSkymap m_cube; //!< Event cube
110 GEbounds m_ebounds; //!< Energy boundaries 108 GEbounds m_ebounds; //!< Energy boundaries
111 GGti m_gti; //!< Good time intervals 109 GGti m_gti; //!< Good time intervals
src/ctbkgcube/ctbkgcube.cpp
@@ -105,7 +105,7 @@ ctbkgcube::ctbkgcube(int argc, char *argv[]) : @@ -105,7 +105,7 @@ ctbkgcube::ctbkgcube(int argc, char *argv[]) :
105 /***********************************************************************//** 105 /***********************************************************************//**
106 * @brief Copy constructor 106 * @brief Copy constructor
107 * 107 *
108 - * @param[in] app ctbkgcube application. 108 + * @param[in] app Application.
109 ***************************************************************************/ 109 ***************************************************************************/
110 ctbkgcube::ctbkgcube(const ctbkgcube& app) : ctool(app) 110 ctbkgcube::ctbkgcube(const ctbkgcube& app) : ctool(app)
111 { 111 {
@@ -142,8 +142,8 @@ ctbkgcube::~ctbkgcube(void) @@ -142,8 +142,8 @@ ctbkgcube::~ctbkgcube(void)
142 /***********************************************************************//** 142 /***********************************************************************//**
143 * @brief Assignment operator 143 * @brief Assignment operator
144 * 144 *
145 - * @param[in] app ctbkgcube application.  
146 - * @return Returns ctbkgcube application. 145 + * @param[in] app Application.
  146 + * @return Returns application.
147 ***************************************************************************/ 147 ***************************************************************************/
148 ctbkgcube& ctbkgcube::operator=(const ctbkgcube& app) 148 ctbkgcube& ctbkgcube::operator=(const ctbkgcube& app)
149 { 149 {
@@ -196,29 +196,6 @@ void ctbkgcube::clear(void) @@ -196,29 +196,6 @@ void ctbkgcube::clear(void)
196 196
197 197
198 /***********************************************************************//** 198 /***********************************************************************//**
199 - * @brief Execute application  
200 - *  
201 - * This is the main execution method of the ctbkgcube class. It is invoked  
202 - * when the executable is called from command line. The method generates  
203 - * the background cube and saves the result.  
204 - ***************************************************************************/  
205 -void ctbkgcube::execute(void)  
206 -{  
207 - // Signal that some parameters should be read ahead  
208 - m_read_ahead = true;  
209 -  
210 - // Create the background cube  
211 - run();  
212 -  
213 - // Save the background cube into the output FITS file  
214 - save();  
215 -  
216 - // Return  
217 - return;  
218 -}  
219 -  
220 -  
221 -/***********************************************************************//**  
222 * @brief Generate the background cube(s). 199 * @brief Generate the background cube(s).
223 * 200 *
224 * This method reads the task parameters from the parfile, sets up the 201 * This method reads the task parameters from the parfile, sets up the
@@ -424,16 +401,12 @@ void ctbkgcube::save(void) @@ -424,16 +401,12 @@ void ctbkgcube::save(void)
424 void ctbkgcube::init_members(void) 401 void ctbkgcube::init_members(void)
425 { 402 {
426 // Initialise members 403 // Initialise members
427 - m_read_ahead = false;  
428 m_obs.clear(); 404 m_obs.clear();
429 m_bkgcube.clear(); 405 m_bkgcube.clear();
430 m_bkgmdl.clear(); 406 m_bkgmdl.clear();
431 m_ebounds.clear(); 407 m_ebounds.clear();
432 m_livetime = 0.0; 408 m_livetime = 0.0;
433 409
434 - // Set logger properties  
435 - log.date(true);  
436 -  
437 // Return 410 // Return
438 return; 411 return;
439 } 412 }
@@ -447,12 +420,11 @@ void ctbkgcube::init_members(void) @@ -447,12 +420,11 @@ void ctbkgcube::init_members(void)
447 void ctbkgcube::copy_members(const ctbkgcube& app) 420 void ctbkgcube::copy_members(const ctbkgcube& app)
448 { 421 {
449 // Copy members 422 // Copy members
450 - m_read_ahead = app.m_read_ahead;  
451 - m_obs = app.m_obs;  
452 - m_bkgcube = app.m_bkgcube;  
453 - m_bkgmdl = app.m_bkgmdl;  
454 - m_ebounds = app.m_ebounds;  
455 - m_livetime = app.m_livetime; 423 + m_obs = app.m_obs;
  424 + m_bkgcube = app.m_bkgcube;
  425 + m_bkgmdl = app.m_bkgmdl;
  426 + m_ebounds = app.m_ebounds;
  427 + m_livetime = app.m_livetime;
456 428
457 // Return 429 // Return
458 return; 430 return;
@@ -540,7 +512,7 @@ void ctbkgcube::get_parameters(void) @@ -540,7 +512,7 @@ void ctbkgcube::get_parameters(void)
540 } 512 }
541 513
542 // Read output filename (if needed) 514 // Read output filename (if needed)
543 - if (m_read_ahead) { 515 + if (read_ahead()) {
544 std::string filename = (*this)["outfile"].filename(); 516 std::string filename = (*this)["outfile"].filename();
545 } 517 }
546 518
src/ctbkgcube/ctbkgcube.hpp
@@ -57,7 +57,6 @@ public: @@ -57,7 +57,6 @@ public:
57 57
58 // Methods 58 // Methods
59 void clear(void); 59 void clear(void);
60 - void execute(void);  
61 void run(void); 60 void run(void);
62 void save(void); 61 void save(void);
63 const GCTAEventCube& cube(void) const; 62 const GCTAEventCube& cube(void) const;
@@ -73,7 +72,6 @@ protected: @@ -73,7 +72,6 @@ protected:
73 void fill_cube(GCTAObservation* obs); 72 void fill_cube(GCTAObservation* obs);
74 73
75 // Protected members 74 // Protected members
76 - bool m_read_ahead; //!< Read ahead parameters  
77 GObservations m_obs; //!< Observation container 75 GObservations m_obs; //!< Observation container
78 GCTAEventCube m_bkgcube; //!< Background cube 76 GCTAEventCube m_bkgcube; //!< Background cube
79 GModels m_bkgmdl; //!< CTA background models 77 GModels m_bkgmdl; //!< CTA background models
src/ctcubemask/ctcubemask.cpp
@@ -143,6 +143,7 @@ ctcubemask::~ctcubemask(void) @@ -143,6 +143,7 @@ ctcubemask::~ctcubemask(void)
143 * @brief Assignment operator 143 * @brief Assignment operator
144 * 144 *
145 * @param[in] app Application. 145 * @param[in] app Application.
  146 + * @return Application.
146 ***************************************************************************/ 147 ***************************************************************************/
147 ctcubemask& ctcubemask::operator=(const ctcubemask& app) 148 ctcubemask& ctcubemask::operator=(const ctcubemask& app)
148 { 149 {
@@ -195,28 +196,6 @@ void ctcubemask::clear(void) @@ -195,28 +196,6 @@ void ctcubemask::clear(void)
195 196
196 197
197 /***********************************************************************//** 198 /***********************************************************************//**
198 - * @brief Execute application  
199 - *  
200 - * This method applies the cube mask and saves the result.  
201 - ***************************************************************************/  
202 -void ctcubemask::execute(void)  
203 -{  
204 - // Signal that some parameters should be read ahead  
205 - m_read_ahead = true;  
206 -  
207 - // Perform event selection  
208 - run();  
209 -  
210 - // Save results  
211 - save();  
212 -  
213 - // Return  
214 - return;  
215 -}  
216 -  
217 -  
218 -  
219 -/***********************************************************************//**  
220 * @brief mask data cube 199 * @brief mask data cube
221 * 200 *
222 * This method reads in the application parameters and loops over all 201 * This method reads in the application parameters and loops over all
@@ -416,7 +395,7 @@ void ctcubemask::get_parameters(void) @@ -416,7 +395,7 @@ void ctcubemask::get_parameters(void)
416 395
417 // Optionally read ahead parameters so that they get correctly 396 // Optionally read ahead parameters so that they get correctly
418 // dumped into the log file 397 // dumped into the log file
419 - if (m_read_ahead) { 398 + if (read_ahead()) {
420 m_outfile = (*this)["outfile"].filename(); 399 m_outfile = (*this)["outfile"].filename();
421 } 400 }
422 401
@@ -574,10 +553,6 @@ void ctcubemask::init_members(void) @@ -574,10 +553,6 @@ void ctcubemask::init_members(void)
574 m_obs.clear(); 553 m_obs.clear();
575 m_infiles.clear(); 554 m_infiles.clear();
576 m_use_xml = false; 555 m_use_xml = false;
577 - m_read_ahead = false;  
578 -  
579 - // Set logger properties  
580 - log.date(true);  
581 556
582 // Return 557 // Return
583 return; 558 return;
@@ -607,7 +582,6 @@ void ctcubemask::copy_members(const ctcubemask&amp; app) @@ -607,7 +582,6 @@ void ctcubemask::copy_members(const ctcubemask&amp; app)
607 m_obs = app.m_obs; 582 m_obs = app.m_obs;
608 m_infiles = app.m_infiles; 583 m_infiles = app.m_infiles;
609 m_use_xml = app.m_use_xml; 584 m_use_xml = app.m_use_xml;
610 - m_read_ahead = app.m_read_ahead;  
611 585
612 // Return 586 // Return
613 return; 587 return;
@@ -619,11 +593,6 @@ void ctcubemask::copy_members(const ctcubemask&amp; app) @@ -619,11 +593,6 @@ void ctcubemask::copy_members(const ctcubemask&amp; app)
619 ***************************************************************************/ 593 ***************************************************************************/
620 void ctcubemask::free_members(void) 594 void ctcubemask::free_members(void)
621 { 595 {
622 - // Write separator into logger  
623 - if (logTerse()) {  
624 - log << std::endl;  
625 - }  
626 -  
627 // Return 596 // Return
628 return; 597 return;
629 } 598 }
src/ctcubemask/ctcubemask.hpp
@@ -59,7 +59,6 @@ public: @@ -59,7 +59,6 @@ public:
59 59
60 // Methods 60 // Methods
61 void clear(void); 61 void clear(void);
62 - void execute(void);  
63 void run(void); 62 void run(void);
64 void save(void); 63 void save(void);
65 const GObservations& obs(void) const; 64 const GObservations& obs(void) const;
@@ -94,7 +93,6 @@ protected: @@ -94,7 +93,6 @@ protected:
94 GObservations m_obs; //!< Observations container 93 GObservations m_obs; //!< Observations container
95 std::vector<std::string> m_infiles; //!< Input event filenames 94 std::vector<std::string> m_infiles; //!< Input event filenames
96 bool m_use_xml; //!< Use XML file instead of FITS file 95 bool m_use_xml; //!< Use XML file instead of FITS file
97 - bool m_read_ahead; //!< Read ahead parameters  
98 }; 96 };
99 97
100 98
src/ctexpcube/ctexpcube.cpp
@@ -113,7 +113,7 @@ ctexpcube::ctexpcube(int argc, char *argv[]) : @@ -113,7 +113,7 @@ ctexpcube::ctexpcube(int argc, char *argv[]) :
113 /***********************************************************************//** 113 /***********************************************************************//**
114 * @brief Copy constructor 114 * @brief Copy constructor
115 * 115 *
116 - * @param[in] app ctexpcube application. 116 + * @param[in] app Application.
117 ***************************************************************************/ 117 ***************************************************************************/
118 ctexpcube::ctexpcube(const ctexpcube& app) : ctool(app) 118 ctexpcube::ctexpcube(const ctexpcube& app) : ctool(app)
119 { 119 {
@@ -150,8 +150,8 @@ ctexpcube::~ctexpcube(void) @@ -150,8 +150,8 @@ ctexpcube::~ctexpcube(void)
150 /***********************************************************************//** 150 /***********************************************************************//**
151 * @brief Assignment operator 151 * @brief Assignment operator
152 * 152 *
153 - * @param[in] app ctexpcube application.  
154 - * @return Returns ctexpcube application. 153 + * @param[in] app Application.
  154 + * @return Application.
155 ***************************************************************************/ 155 ***************************************************************************/
156 ctexpcube& ctexpcube::operator=(const ctexpcube& app) 156 ctexpcube& ctexpcube::operator=(const ctexpcube& app)
157 { 157 {
@@ -204,29 +204,6 @@ void ctexpcube::clear(void) @@ -204,29 +204,6 @@ void ctexpcube::clear(void)
204 204
205 205
206 /***********************************************************************//** 206 /***********************************************************************//**
207 - * @brief Execute application  
208 - *  
209 - * This is the main execution method of the ctexpcube class. It is invoked  
210 - * when the executable is called from command line. The method generates  
211 - * the exposure cube and saves the result.  
212 - ***************************************************************************/  
213 -void ctexpcube::execute(void)  
214 -{  
215 - // Signal that some parameters should be read ahead  
216 - m_read_ahead = true;  
217 -  
218 - // Create the exposure cube  
219 - run();  
220 -  
221 - // Save the exposure cube into the output FITS file  
222 - save();  
223 -  
224 - // Return  
225 - return;  
226 -}  
227 -  
228 -  
229 -/***********************************************************************//**  
230 * @brief Generate the exposure cube(s). 207 * @brief Generate the exposure cube(s).
231 * 208 *
232 * This method reads the task parameters from the parfile, sets up the 209 * This method reads the task parameters from the parfile, sets up the
@@ -333,14 +310,10 @@ void ctexpcube::init_members(void) @@ -333,14 +310,10 @@ void ctexpcube::init_members(void)
333 m_apply_edisp = false; 310 m_apply_edisp = false;
334 311
335 // Initialise protected members 312 // Initialise protected members
336 - m_read_ahead = false;  
337 m_obs.clear(); 313 m_obs.clear();
338 m_expcube.clear(); 314 m_expcube.clear();
339 m_ebounds.clear(); 315 m_ebounds.clear();
340 316
341 - // Set logger properties  
342 - log.date(true);  
343 -  
344 // Return 317 // Return
345 return; 318 return;
346 } 319 }
@@ -358,7 +331,6 @@ void ctexpcube::copy_members(const ctexpcube&amp; app) @@ -358,7 +331,6 @@ void ctexpcube::copy_members(const ctexpcube&amp; app)
358 m_apply_edisp = app.m_apply_edisp; 331 m_apply_edisp = app.m_apply_edisp;
359 332
360 // Copy protected members 333 // Copy protected members
361 - m_read_ahead = app.m_read_ahead;  
362 m_obs = app.m_obs; 334 m_obs = app.m_obs;
363 m_expcube = app.m_expcube; 335 m_expcube = app.m_expcube;
364 m_ebounds = app.m_ebounds; 336 m_ebounds = app.m_ebounds;
@@ -433,7 +405,7 @@ void ctexpcube::get_parameters(void) @@ -433,7 +405,7 @@ void ctexpcube::get_parameters(void)
433 } 405 }
434 406
435 // Read output filename (if needed) 407 // Read output filename (if needed)
436 - if (m_read_ahead) { 408 + if (read_ahead()) {
437 m_outfile = (*this)["outfile"].filename(); 409 m_outfile = (*this)["outfile"].filename();
438 } 410 }
439 411
src/ctexpcube/ctexpcube.hpp
@@ -57,7 +57,6 @@ public: @@ -57,7 +57,6 @@ public:
57 57
58 // Methods 58 // Methods
59 void clear(void); 59 void clear(void);
60 - void execute(void);  
61 void run(void); 60 void run(void);
62 void save(void); 61 void save(void);
63 const GCTAExposure& expcube(void) const; 62 const GCTAExposure& expcube(void) const;
@@ -76,7 +75,6 @@ protected: @@ -76,7 +75,6 @@ protected:
76 bool m_apply_edisp; //!< Apply energy dispersion? 75 bool m_apply_edisp; //!< Apply energy dispersion?
77 76
78 // Protected members 77 // Protected members
79 - bool m_read_ahead; //!< Read ahead parameters  
80 GObservations m_obs; //!< Observation container 78 GObservations m_obs; //!< Observation container
81 GCTAExposure m_expcube; //!< Exposure cube 79 GCTAExposure m_expcube; //!< Exposure cube
82 GEbounds m_ebounds; //!< Energy boundaries 80 GEbounds m_ebounds; //!< Energy boundaries
src/ctlike/ctlike.cpp
@@ -138,6 +138,7 @@ ctlike::~ctlike(void) @@ -138,6 +138,7 @@ ctlike::~ctlike(void)
138 * @brief Assignment operator 138 * @brief Assignment operator
139 * 139 *
140 * @param[in] app Application. 140 * @param[in] app Application.
  141 + * @return Application.
141 ***************************************************************************/ 142 ***************************************************************************/
142 ctlike& ctlike::operator=(const ctlike& app) 143 ctlike& ctlike::operator=(const ctlike& app)
143 { 144 {
@@ -190,28 +191,6 @@ void ctlike::clear(void) @@ -190,28 +191,6 @@ void ctlike::clear(void)
190 191
191 192
192 /***********************************************************************//** 193 /***********************************************************************//**
193 - * @brief Execute application  
194 - *  
195 - * This method performs a maximum likelihood analysis of a observation given  
196 - * in an observation container and saves the results in an XML file.  
197 - ***************************************************************************/  
198 -void ctlike::execute(void)  
199 -{  
200 - // Signal that some parameters should be read ahead  
201 - m_read_ahead = true;  
202 -  
203 - // Bin the event data  
204 - run();  
205 -  
206 - // Save the results into XML file  
207 - save();  
208 -  
209 - // Return  
210 - return;  
211 -}  
212 -  
213 -  
214 -/***********************************************************************//**  
215 * @brief Run maximum likelihood analysis 194 * @brief Run maximum likelihood analysis
216 * 195 *
217 * The following analysis steps are performed: 196 * The following analysis steps are performed:
@@ -442,7 +421,7 @@ void ctlike::get_parameters(void) @@ -442,7 +421,7 @@ void ctlike::get_parameters(void)
442 421
443 // Optionally read ahead parameters so that they get correctly 422 // Optionally read ahead parameters so that they get correctly
444 // dumped into the log file 423 // dumped into the log file
445 - if (m_read_ahead) { 424 + if (read_ahead()) {
446 m_outmdl = (*this)["outmdl"].filename(); 425 m_outmdl = (*this)["outmdl"].filename();
447 } 426 }
448 427
@@ -572,7 +551,6 @@ void ctlike::init_members(void) @@ -572,7 +551,6 @@ void ctlike::init_members(void)
572 m_max_stall = 10; // Set maximum number of stalls 551 m_max_stall = 10; // Set maximum number of stalls
573 m_logL = 0.0; 552 m_logL = 0.0;
574 m_opt = NULL; 553 m_opt = NULL;
575 - m_read_ahead = false;  
576 m_apply_edisp = false; 554 m_apply_edisp = false;
577 555
578 // Set logger properties 556 // Set logger properties
@@ -599,7 +577,6 @@ void ctlike::copy_members(const ctlike&amp; app) @@ -599,7 +577,6 @@ void ctlike::copy_members(const ctlike&amp; app)
599 m_max_stall = app.m_max_stall; 577 m_max_stall = app.m_max_stall;
600 m_logL = app.m_logL; 578 m_logL = app.m_logL;
601 m_opt = app.m_opt->clone(); 579 m_opt = app.m_opt->clone();
602 - m_read_ahead = app.m_read_ahead;  
603 m_apply_edisp = app.m_apply_edisp; 580 m_apply_edisp = app.m_apply_edisp;
604 581
605 // Return 582 // Return
@@ -618,11 +595,6 @@ void ctlike::free_members(void) @@ -618,11 +595,6 @@ void ctlike::free_members(void)
618 // Mark pointers as free 595 // Mark pointers as free
619 m_opt = NULL; 596 m_opt = NULL;
620 597
621 - // Write separator into logger  
622 - if (logTerse()) {  
623 - log << std::endl;  
624 - }  
625 -  
626 // Return 598 // Return
627 return; 599 return;
628 } 600 }
src/ctlike/ctlike.hpp
@@ -58,7 +58,6 @@ public: @@ -58,7 +58,6 @@ public:
58 58
59 // Methods 59 // Methods
60 void clear(void); 60 void clear(void);
61 - void execute(void);  
62 void run(void); 61 void run(void);
63 void save(void); 62 void save(void);
64 const GObservations& obs(void) const; 63 const GObservations& obs(void) const;
@@ -85,7 +84,6 @@ protected: @@ -85,7 +84,6 @@ protected:
85 int m_max_stall; //!< Maximum number of stalls 84 int m_max_stall; //!< Maximum number of stalls
86 double m_logL; //!< Maximum log likelihood 85 double m_logL; //!< Maximum log likelihood
87 GOptimizer* m_opt; //!< Optimizer 86 GOptimizer* m_opt; //!< Optimizer
88 - bool m_read_ahead; //!< Read ahead parameters  
89 }; 87 };
90 88
91 89
src/ctmodel/ctmodel.cpp
@@ -137,8 +137,8 @@ ctmodel::~ctmodel(void) @@ -137,8 +137,8 @@ ctmodel::~ctmodel(void)
137 /***********************************************************************//** 137 /***********************************************************************//**
138 * @brief Assignment operator 138 * @brief Assignment operator
139 * 139 *
140 - * @param[in] app ctmodel application.  
141 - * @return Returns ctmodel application. 140 + * @param[in] app Application.
  141 + * @return Application.
142 ***************************************************************************/ 142 ***************************************************************************/
143 ctmodel& ctmodel::operator=(const ctmodel& app) 143 ctmodel& ctmodel::operator=(const ctmodel& app)
144 { 144 {
@@ -191,29 +191,6 @@ void ctmodel::clear(void) @@ -191,29 +191,6 @@ void ctmodel::clear(void)
191 191
192 192
193 /***********************************************************************//** 193 /***********************************************************************//**
194 - * @brief Execute application  
195 - *  
196 - * This is the main execution method of the ctmodel class. It is invoked  
197 - * when the executable is called from command line. The method generates  
198 - * the model maps and saves the results.  
199 - ***************************************************************************/  
200 -void ctmodel::execute(void)  
201 -{  
202 - // Signal that some parameters should be read ahead  
203 - m_read_ahead = true;  
204 -  
205 - // Create model cube  
206 - run();  
207 -  
208 - // Save model cube into FITS file  
209 - save();  
210 -  
211 - // Return  
212 - return;  
213 -}  
214 -  
215 -  
216 -/***********************************************************************//**  
217 * @brief Generate the model map(s) 194 * @brief Generate the model map(s)
218 * 195 *
219 * This method reads the task parameters from the parfile, sets up the 196 * This method reads the task parameters from the parfile, sets up the
@@ -385,10 +362,6 @@ void ctmodel::init_members(void) @@ -385,10 +362,6 @@ void ctmodel::init_members(void)
385 m_cube.clear(); 362 m_cube.clear();
386 m_ebounds.clear(); 363 m_ebounds.clear();
387 m_gti.clear(); 364 m_gti.clear();
388 - m_read_ahead = false;  
389 -  
390 - // Set logger properties  
391 - log.date(true);  
392 365
393 // Return 366 // Return
394 return; 367 return;
@@ -433,7 +406,6 @@ void ctmodel::copy_members(const ctmodel&amp; app) @@ -433,7 +406,6 @@ void ctmodel::copy_members(const ctmodel&amp; app)
433 m_cube = app.m_cube; 406 m_cube = app.m_cube;
434 m_ebounds = app.m_ebounds; 407 m_ebounds = app.m_ebounds;
435 m_gti = app.m_gti; 408 m_gti = app.m_gti;
436 - m_read_ahead = app.m_read_ahead;  
437 409
438 // Return 410 // Return
439 return; 411 return;
@@ -460,7 +432,7 @@ void ctmodel::get_parameters(void) @@ -460,7 +432,7 @@ void ctmodel::get_parameters(void)
460 { 432 {
461 // Read input and optionally output cube filenames 433 // Read input and optionally output cube filenames
462 m_infile = (*this)["infile"].filename(); 434 m_infile = (*this)["infile"].filename();
463 - if (m_read_ahead) { 435 + if (read_ahead()) {
464 m_outfile = (*this)["outfile"].filename(); 436 m_outfile = (*this)["outfile"].filename();
465 } 437 }
466 438
src/ctmodel/ctmodel.hpp
@@ -66,7 +66,6 @@ public: @@ -66,7 +66,6 @@ public:
66 66
67 // Methods 67 // Methods
68 void clear(void); 68 void clear(void);
69 - void execute(void);  
70 void run(void); 69 void run(void);
71 void save(void); 70 void save(void);
72 const GObservations& obs(void) const; 71 const GObservations& obs(void) const;
@@ -113,7 +112,6 @@ protected: @@ -113,7 +112,6 @@ protected:
113 GCTAEventCube m_cube; //!< Model cube 112 GCTAEventCube m_cube; //!< Model cube
114 GEbounds m_ebounds; //!< Energy boundaries 113 GEbounds m_ebounds; //!< Energy boundaries
115 GGti m_gti; //!< Model cube GTIs 114 GGti m_gti; //!< Model cube GTIs
116 - bool m_read_ahead; //!< Read ahead parameters  
117 }; 115 };
118 116
119 117
src/ctobssim/ctobssim.cpp
@@ -197,27 +197,6 @@ void ctobssim::clear(void) @@ -197,27 +197,6 @@ void ctobssim::clear(void)
197 197
198 198
199 /***********************************************************************//** 199 /***********************************************************************//**
200 - * @brief Execute application  
201 - *  
202 - * This method runs the simulation and saves the results.  
203 - ***************************************************************************/  
204 -void ctobssim::execute(void)  
205 -{  
206 - // Signal that some parameters should be read ahead  
207 - m_read_ahead = true;  
208 -  
209 - // Run the simulation  
210 - run();  
211 -  
212 - // Save results  
213 - save();  
214 -  
215 - // Return  
216 - return;  
217 -}  
218 -  
219 -  
220 -/***********************************************************************//**  
221 * @brief Simulate event data 200 * @brief Simulate event data
222 * 201 *
223 * This method runs the simulation. Results are not saved by this method. 202 * This method runs the simulation. Results are not saved by this method.
@@ -489,7 +468,7 @@ void ctobssim::get_parameters(void) @@ -489,7 +468,7 @@ void ctobssim::get_parameters(void)
489 468
490 // Optionally read ahead parameters so that they get correctly 469 // Optionally read ahead parameters so that they get correctly
491 // dumped into the log file 470 // dumped into the log file
492 - if (m_read_ahead) { 471 + if (read_ahead()) {
493 m_outfile = (*this)["outfile"].filename(); 472 m_outfile = (*this)["outfile"].filename();
494 m_prefix = (*this)["prefix"].string(); 473 m_prefix = (*this)["prefix"].string();
495 } 474 }
@@ -1038,7 +1017,6 @@ void ctobssim::init_members(void) @@ -1038,7 +1017,6 @@ void ctobssim::init_members(void)
1038 m_rans.clear(); 1017 m_rans.clear();
1039 m_obs.clear(); 1018 m_obs.clear();
1040 m_use_xml = false; 1019 m_use_xml = false;
1041 - m_read_ahead = false;  
1042 1020
1043 // Set fixed parameters 1021 // Set fixed parameters
1044 m_area = 19634954.0 * 1.0e4; //!< pi*(2500^2) m^2 1022 m_area = 19634954.0 * 1.0e4; //!< pi*(2500^2) m^2
@@ -1052,9 +1030,6 @@ void ctobssim::init_members(void) @@ -1052,9 +1030,6 @@ void ctobssim::init_members(void)
1052 // Initialise first event identifier 1030 // Initialise first event identifier
1053 m_event_id = 1; 1031 m_event_id = 1;
1054 1032
1055 - // Set logger properties  
1056 - log.date(true);  
1057 -  
1058 // Return 1033 // Return
1059 return; 1034 return;
1060 } 1035 }
@@ -1088,7 +1063,6 @@ void ctobssim::copy_members(const ctobssim&amp; app) @@ -1088,7 +1063,6 @@ void ctobssim::copy_members(const ctobssim&amp; app)
1088 m_rans = app.m_rans; 1063 m_rans = app.m_rans;
1089 m_obs = app.m_obs; 1064 m_obs = app.m_obs;
1090 m_use_xml = app.m_use_xml; 1065 m_use_xml = app.m_use_xml;
1091 - m_read_ahead = app.m_read_ahead;  
1092 m_cta_ref = app.m_cta_ref; 1066 m_cta_ref = app.m_cta_ref;
1093 m_event_id = app.m_event_id; 1067 m_event_id = app.m_event_id;
1094 1068
src/ctobssim/ctobssim.hpp
@@ -63,7 +63,6 @@ public: @@ -63,7 +63,6 @@ public:
63 63
64 // Methods 64 // Methods
65 void clear(void); 65 void clear(void);
66 - void execute(void);  
67 void run(void); 66 void run(void);
68 void save(void); 67 void save(void);
69 const GObservations& obs(void) const; 68 const GObservations& obs(void) const;
@@ -107,7 +106,6 @@ protected: @@ -107,7 +106,6 @@ protected:
107 std::vector<GRan> m_rans; //!< Random number generators 106 std::vector<GRan> m_rans; //!< Random number generators
108 GObservations m_obs; //!< Observation container 107 GObservations m_obs; //!< Observation container
109 bool m_use_xml; //!< Use XML file instead of FITS file 108 bool m_use_xml; //!< Use XML file instead of FITS file
110 - bool m_read_ahead; //!< Read ahead parameters  
111 GTimeReference m_cta_ref; //!< CTA time reference 109 GTimeReference m_cta_ref; //!< CTA time reference
112 int m_event_id; //!< Event identifier 110 int m_event_id; //!< Event identifier
113 }; 111 };
src/ctpsfcube/ctpsfcube.cpp
@@ -104,7 +104,7 @@ ctpsfcube::ctpsfcube(int argc, char *argv[]) : @@ -104,7 +104,7 @@ ctpsfcube::ctpsfcube(int argc, char *argv[]) :
104 /***********************************************************************//** 104 /***********************************************************************//**
105 * @brief Copy constructor 105 * @brief Copy constructor
106 * 106 *
107 - * @param[in] app ctpsfcube application. 107 + * @param[in] app Application.
108 ***************************************************************************/ 108 ***************************************************************************/
109 ctpsfcube::ctpsfcube(const ctpsfcube& app) : ctool(app) 109 ctpsfcube::ctpsfcube(const ctpsfcube& app) : ctool(app)
110 { 110 {
@@ -141,8 +141,8 @@ ctpsfcube::~ctpsfcube(void) @@ -141,8 +141,8 @@ ctpsfcube::~ctpsfcube(void)
141 /***********************************************************************//** 141 /***********************************************************************//**
142 * @brief Assignment operator 142 * @brief Assignment operator
143 * 143 *
144 - * @param[in] app ctpsfcube application.  
145 - * @return Returns ctpsfcube application. 144 + * @param[in] app Application.
  145 + * @return Application.
146 ***************************************************************************/ 146 ***************************************************************************/
147 ctpsfcube& ctpsfcube::operator=(const ctpsfcube& app) 147 ctpsfcube& ctpsfcube::operator=(const ctpsfcube& app)
148 { 148 {
@@ -195,29 +195,6 @@ void ctpsfcube::clear(void) @@ -195,29 +195,6 @@ void ctpsfcube::clear(void)
195 195
196 196
197 /***********************************************************************//** 197 /***********************************************************************//**
198 - * @brief Execute application  
199 - *  
200 - * This is the main execution method of the ctpsfcube class. It is invoked  
201 - * when the executable is called from command line. The method generates  
202 - * the PSF cube and saves the result.  
203 - ***************************************************************************/  
204 -void ctpsfcube::execute(void)  
205 -{  
206 - // Signal that some parameters should be read ahead  
207 - m_read_ahead = true;  
208 -  
209 - // Create the PSF cube  
210 - run();  
211 -  
212 - // Save the PSF cube into the output FITS file  
213 - save();  
214 -  
215 - // Return  
216 - return;  
217 -}  
218 -  
219 -  
220 -/***********************************************************************//**  
221 * @brief Generate the model map(s) 198 * @brief Generate the model map(s)
222 * 199 *
223 * This method reads the task parameters from the parfile, sets up the 200 * This method reads the task parameters from the parfile, sets up the
@@ -324,14 +301,10 @@ void ctpsfcube::init_members(void) @@ -324,14 +301,10 @@ void ctpsfcube::init_members(void)
324 m_apply_edisp = false; 301 m_apply_edisp = false;
325 302
326 // Initialise protected members 303 // Initialise protected members
327 - m_read_ahead = false;  
328 m_obs.clear(); 304 m_obs.clear();
329 m_psfcube.clear(); 305 m_psfcube.clear();
330 m_ebounds.clear(); 306 m_ebounds.clear();
331 307
332 - // Set logger properties  
333 - log.date(true);  
334 -  
335 // Return 308 // Return
336 return; 309 return;
337 } 310 }
@@ -349,7 +322,6 @@ void ctpsfcube::copy_members(const ctpsfcube&amp; app) @@ -349,7 +322,6 @@ void ctpsfcube::copy_members(const ctpsfcube&amp; app)
349 m_apply_edisp = app.m_apply_edisp; 322 m_apply_edisp = app.m_apply_edisp;
350 323
351 // Copy protected members 324 // Copy protected members
352 - m_read_ahead = app.m_read_ahead;  
353 m_obs = app.m_obs; 325 m_obs = app.m_obs;
354 m_psfcube = app.m_psfcube; 326 m_psfcube = app.m_psfcube;
355 m_ebounds = app.m_ebounds; 327 m_ebounds = app.m_ebounds;
@@ -426,7 +398,7 @@ void ctpsfcube::get_parameters(void) @@ -426,7 +398,7 @@ void ctpsfcube::get_parameters(void)
426 } 398 }
427 399
428 // Read output filename (if needed) 400 // Read output filename (if needed)
429 - if (m_read_ahead) { 401 + if (read_ahead()) {
430 m_outfile = (*this)["outfile"].filename(); 402 m_outfile = (*this)["outfile"].filename();
431 } 403 }
432 404
src/ctpsfcube/ctpsfcube.hpp
@@ -57,7 +57,6 @@ public: @@ -57,7 +57,6 @@ public:
57 57
58 // Methods 58 // Methods
59 void clear(void); 59 void clear(void);
60 - void execute(void);  
61 void run(void); 60 void run(void);
62 void save(void); 61 void save(void);
63 const GCTAMeanPsf& psfcube(void) const; 62 const GCTAMeanPsf& psfcube(void) const;
@@ -76,7 +75,6 @@ protected: @@ -76,7 +75,6 @@ protected:
76 bool m_apply_edisp; //!< Apply energy dispersion? 75 bool m_apply_edisp; //!< Apply energy dispersion?
77 76
78 // Protected members 77 // Protected members
79 - bool m_read_ahead; //!< Read ahead parameters  
80 GObservations m_obs; //!< Observation container 78 GObservations m_obs; //!< Observation container
81 GCTAMeanPsf m_psfcube; //!< PSF cube 79 GCTAMeanPsf m_psfcube; //!< PSF cube
82 GEbounds m_ebounds; //!< Energy boundaries 80 GEbounds m_ebounds; //!< Energy boundaries
src/ctselect/ctselect.cpp
@@ -144,6 +144,7 @@ ctselect::~ctselect(void) @@ -144,6 +144,7 @@ ctselect::~ctselect(void)
144 * @brief Assignment operator 144 * @brief Assignment operator
145 * 145 *
146 * @param[in] app Application. 146 * @param[in] app Application.
  147 + * @return Application.
147 ***************************************************************************/ 148 ***************************************************************************/
148 ctselect& ctselect::operator=(const ctselect& app) 149 ctselect& ctselect::operator=(const ctselect& app)
149 { 150 {
@@ -196,28 +197,6 @@ void ctselect::clear(void) @@ -196,28 +197,6 @@ void ctselect::clear(void)
196 197
197 198
198 /***********************************************************************//** 199 /***********************************************************************//**
199 - * @brief Execute application  
200 - *  
201 - * This method performs the event selection and saves the result  
202 - ***************************************************************************/  
203 -void ctselect::execute(void)  
204 -{  
205 - // Signal that some parameters should be read ahead  
206 - m_read_ahead = true;  
207 -  
208 - // Perform event selection  
209 - run();  
210 -  
211 - // Save results  
212 - save();  
213 -  
214 - // Return  
215 - return;  
216 -}  
217 -  
218 -  
219 -  
220 -/***********************************************************************//**  
221 * @brief Select event data 200 * @brief Select event data
222 * 201 *
223 * This method reads in the application parameters and loops over all 202 * This method reads in the application parameters and loops over all
@@ -458,7 +437,7 @@ void ctselect::get_parameters(void) @@ -458,7 +437,7 @@ void ctselect::get_parameters(void)
458 437
459 // Optionally read ahead parameters so that they get correctly 438 // Optionally read ahead parameters so that they get correctly
460 // dumped into the log file 439 // dumped into the log file
461 - if (m_read_ahead) { 440 + if (read_ahead()) {
462 m_outfile = (*this)["outfile"].filename(); 441 m_outfile = (*this)["outfile"].filename();
463 m_prefix = (*this)["prefix"].string(); 442 m_prefix = (*this)["prefix"].string();
464 } 443 }
@@ -706,16 +685,12 @@ void ctselect::init_members(void) @@ -706,16 +685,12 @@ void ctselect::init_members(void)
706 m_timemin.clear(); 685 m_timemin.clear();
707 m_timemax.clear(); 686 m_timemax.clear();
708 m_use_xml = false; 687 m_use_xml = false;
709 - m_read_ahead = false;  
710 688
711 // Set CTA time reference. G_CTA_MJDREF is the CTA reference MJD, 689 // Set CTA time reference. G_CTA_MJDREF is the CTA reference MJD,
712 // which is defined in GCTALib.hpp. This is somehow a kluge. We need 690 // which is defined in GCTALib.hpp. This is somehow a kluge. We need
713 // a better mechanism to implement the CTA reference MJD. 691 // a better mechanism to implement the CTA reference MJD.
714 m_cta_ref.set(G_CTA_MJDREF, "s", "TT", "LOCAL"); 692 m_cta_ref.set(G_CTA_MJDREF, "s", "TT", "LOCAL");
715 693
716 - // Set logger properties  
717 - log.date(true);  
718 -  
719 // Return 694 // Return
720 return; 695 return;
721 } 696 }
@@ -748,7 +723,6 @@ void ctselect::copy_members(const ctselect&amp; app) @@ -748,7 +723,6 @@ void ctselect::copy_members(const ctselect&amp; app)
748 m_timemin = app.m_timemin; 723 m_timemin = app.m_timemin;
749 m_timemax = app.m_timemax; 724 m_timemax = app.m_timemax;
750 m_use_xml = app.m_use_xml; 725 m_use_xml = app.m_use_xml;
751 - m_read_ahead = app.m_read_ahead;  
752 m_cta_ref = app.m_cta_ref; 726 m_cta_ref = app.m_cta_ref;
753 727
754 // Return 728 // Return
src/ctselect/ctselect.hpp
@@ -59,7 +59,6 @@ public: @@ -59,7 +59,6 @@ public:
59 59
60 // Methods 60 // Methods
61 void clear(void); 61 void clear(void);
62 - void execute(void);  
63 void run(void); 62 void run(void);
64 void save(void); 63 void save(void);
65 const GObservations& obs(void) const; 64 const GObservations& obs(void) const;
@@ -100,7 +99,6 @@ protected: @@ -100,7 +99,6 @@ protected:
100 GTime m_timemin; //!< Earliest time 99 GTime m_timemin; //!< Earliest time
101 GTime m_timemax; //!< Latest time 100 GTime m_timemax; //!< Latest time
102 bool m_use_xml; //!< Use XML file instead of FITS file 101 bool m_use_xml; //!< Use XML file instead of FITS file
103 - bool m_read_ahead; //!< Read ahead parameters  
104 GTimeReference m_cta_ref; //!< CTA time reference 102 GTimeReference m_cta_ref; //!< CTA time reference
105 }; 103 };
106 104
src/ctskymap/ctskymap.cpp
@@ -141,6 +141,7 @@ ctskymap::~ctskymap(void) @@ -141,6 +141,7 @@ ctskymap::~ctskymap(void)
141 * @brief Assignment operator 141 * @brief Assignment operator
142 * 142 *
143 * @param[in] app Application. 143 * @param[in] app Application.
  144 + * @return Application.
144 ***************************************************************************/ 145 ***************************************************************************/
145 ctskymap& ctskymap::operator=(const ctskymap& app) 146 ctskymap& ctskymap::operator=(const ctskymap& app)
146 { 147 {
@@ -193,28 +194,6 @@ void ctskymap::clear(void) @@ -193,28 +194,6 @@ void ctskymap::clear(void)
193 194
194 195
195 /***********************************************************************//** 196 /***********************************************************************//**
196 - * @brief Execute application  
197 - *  
198 - * This method creates the sky map and saves the map into a FITS file.  
199 - ***************************************************************************/  
200 -void ctskymap::execute(void)  
201 -{  
202 - // Read ahead output filename so that it gets dumped correctly in the  
203 - // parameters log  
204 - m_outfile = (*this)["outfile"].filename();  
205 -  
206 - // Create the sky map  
207 - run();  
208 -  
209 - // Save the sky map into FITS file  
210 - save();  
211 -  
212 - // Return  
213 - return;  
214 -}  
215 -  
216 -  
217 -/***********************************************************************//**  
218 * @brief Creates sky maps from data 197 * @brief Creates sky maps from data
219 * 198 *
220 * This method is the main code. It 199 * This method is the main code. It
@@ -383,6 +362,11 @@ void ctskymap::get_parameters(void) @@ -383,6 +362,11 @@ void ctskymap::get_parameters(void)
383 m_nxpix = (*this)["nxpix"].integer(); 362 m_nxpix = (*this)["nxpix"].integer();
384 m_nypix = (*this)["nypix"].integer(); 363 m_nypix = (*this)["nypix"].integer();
385 364
  365 + // Read ahead parameters
  366 + if (read_ahead()) {
  367 + m_outfile = (*this)["outfile"].filename();
  368 + }
  369 +
386 // Return 370 // Return
387 return; 371 return;
388 } 372 }
@@ -555,9 +539,6 @@ void ctskymap::init_members(void) @@ -555,9 +539,6 @@ void ctskymap::init_members(void)
555 m_nxpix = 0; 539 m_nxpix = 0;
556 m_nypix = 0; 540 m_nypix = 0;
557 541
558 - // Set logger properties  
559 - log.date(true);  
560 -  
561 // Return 542 // Return
562 return; 543 return;
563 } 544 }
src/ctskymap/ctskymap.hpp
@@ -59,7 +59,6 @@ public: @@ -59,7 +59,6 @@ public:
59 59
60 // Methods 60 // Methods
61 void clear(void); 61 void clear(void);
62 - void execute(void);  
63 void run(void); 62 void run(void);
64 void save(void); 63 void save(void);
65 const GSkymap& map(void) const; 64 const GSkymap& map(void) const;
src/cttsmap/cttsmap.cpp
@@ -140,6 +140,7 @@ cttsmap::~cttsmap(void) @@ -140,6 +140,7 @@ cttsmap::~cttsmap(void)
140 * @brief Assignment operator 140 * @brief Assignment operator
141 * 141 *
142 * @param[in] app Application. 142 * @param[in] app Application.
  143 + * @return Application.
143 ***************************************************************************/ 144 ***************************************************************************/
144 cttsmap& cttsmap::operator=(const cttsmap& app) 145 cttsmap& cttsmap::operator=(const cttsmap& app)
145 { 146 {
@@ -192,31 +193,6 @@ void cttsmap::clear(void) @@ -192,31 +193,6 @@ void cttsmap::clear(void)
192 193
193 194
194 /***********************************************************************//** 195 /***********************************************************************//**
195 - * @brief Execute application  
196 - *  
197 - * This is the main execution method of the cttsmap class. It is invoked when  
198 - * the executable is called from command line.  
199 - *  
200 - * The method reads the task parameters, computes the TS values, stores the  
201 - * results into map(s), and writes the maps into a FITS file on disk.  
202 - ***************************************************************************/  
203 -void cttsmap::execute(void)  
204 -{  
205 - // Signal that some parameters should be read ahead  
206 - m_read_ahead = true;  
207 -  
208 - // Compute the maps  
209 - run();  
210 -  
211 - // Save the maps into FITS file  
212 - save();  
213 -  
214 - // Return  
215 - return;  
216 -}  
217 -  
218 -  
219 -/***********************************************************************//**  
220 * @brief Computes the TS maps 196 * @brief Computes the TS maps
221 * 197 *
222 * This method moves a source along a grid of coordinates and refits the 198 * This method moves a source along a grid of coordinates and refits the
@@ -447,7 +423,6 @@ void cttsmap::init_members(void) @@ -447,7 +423,6 @@ void cttsmap::init_members(void)
447 423
448 // Initialise protected members 424 // Initialise protected members
449 m_obs.clear(); 425 m_obs.clear();
450 - m_read_ahead = false;  
451 m_binmin = -1; 426 m_binmin = -1;
452 m_binmax = -1; 427 m_binmax = -1;
453 m_logL0 = 0.0; 428 m_logL0 = 0.0;
@@ -457,9 +432,6 @@ void cttsmap::init_members(void) @@ -457,9 +432,6 @@ void cttsmap::init_members(void)
457 m_maps.clear(); 432 m_maps.clear();
458 m_testsource = NULL; 433 m_testsource = NULL;
459 434
460 - // Set logger properties  
461 - log.date(true);  
462 -  
463 // Return 435 // Return
464 return; 436 return;
465 } 437 }
@@ -488,7 +460,6 @@ void cttsmap::copy_members(const cttsmap&amp; app) @@ -488,7 +460,6 @@ void cttsmap::copy_members(const cttsmap&amp; app)
488 m_binmax = app.m_binmax; 460 m_binmax = app.m_binmax;
489 m_logL0 = app.m_logL0; 461 m_logL0 = app.m_logL0;
490 m_obs = app.m_obs; 462 m_obs = app.m_obs;
491 - m_read_ahead = app.m_read_ahead;  
492 m_tsmap = app.m_tsmap; 463 m_tsmap = app.m_tsmap;
493 m_mapnames = app.m_mapnames; 464 m_mapnames = app.m_mapnames;
494 m_maps = app.m_maps; 465 m_maps = app.m_maps;
@@ -624,7 +595,7 @@ void cttsmap::get_parameters(void) @@ -624,7 +595,7 @@ void cttsmap::get_parameters(void)
624 595
625 // Optionally read ahead parameters so that they get correctly 596 // Optionally read ahead parameters so that they get correctly
626 // dumped into the log file 597 // dumped into the log file
627 - if (m_read_ahead) { 598 + if (read_ahead()) {
628 m_outfile = (*this)["outfile"].filename(); 599 m_outfile = (*this)["outfile"].filename();
629 } 600 }
630 601
src/cttsmap/cttsmap.hpp
@@ -70,7 +70,6 @@ public: @@ -70,7 +70,6 @@ public:
70 70
71 // Methods 71 // Methods
72 void clear(void); 72 void clear(void);
73 - void execute(void);  
74 void run(void); 73 void run(void);
75 void save(void); 74 void save(void);
76 const GObservations& obs(void) const; 75 const GObservations& obs(void) const;
@@ -103,7 +102,6 @@ protected: @@ -103,7 +102,6 @@ protected:
103 102
104 // Protected members 103 // Protected members
105 GObservations m_obs; //!< Observation container 104 GObservations m_obs; //!< Observation container
106 - bool m_read_ahead; //!< Read ahead parameters  
107 GSkymap m_tsmap; //!< TS map 105 GSkymap m_tsmap; //!< TS map
108 GSkymap m_statusmap; //!< Map of computed bins 106 GSkymap m_statusmap; //!< Map of computed bins
109 std::vector<std::string> m_mapnames; //!< Names of free parameters 107 std::vector<std::string> m_mapnames; //!< Names of free parameters
src/support/ctool.cpp
@@ -176,6 +176,26 @@ ctool&amp; ctool::operator=(const ctool&amp; app) @@ -176,6 +176,26 @@ ctool&amp; ctool::operator=(const ctool&amp; app)
176 = = 176 = =
177 ==========================================================================*/ 177 ==========================================================================*/
178 178
  179 +/***********************************************************************//**
  180 + * @brief Execute application
  181 + *
  182 + * This is the main execution method of a ctool. The method is invoked when
  183 + * the executable is called from command line.
  184 + ***************************************************************************/
  185 +void ctool::execute(void)
  186 +{
  187 + // Signal that some parameters should be read ahead
  188 + m_read_ahead = true;
  189 +
  190 + // Run the tool
  191 + run();
  192 +
  193 + // Save the results
  194 + save();
  195 +
  196 + // Return
  197 + return;
  198 +}
179 199
180 200
181 /*========================================================================== 201 /*==========================================================================
@@ -190,6 +210,10 @@ ctool&amp; ctool::operator=(const ctool&amp; app) @@ -190,6 +210,10 @@ ctool&amp; ctool::operator=(const ctool&amp; app)
190 void ctool::init_members(void) 210 void ctool::init_members(void)
191 { 211 {
192 // Initialise members 212 // Initialise members
  213 + m_read_ahead = false;
  214 +
  215 + // Set logger properties
  216 + log.date(true);
193 217
194 // Return 218 // Return
195 return; 219 return;
@@ -203,7 +227,8 @@ void ctool::init_members(void) @@ -203,7 +227,8 @@ void ctool::init_members(void)
203 ***************************************************************************/ 227 ***************************************************************************/
204 void ctool::copy_members(const ctool& app) 228 void ctool::copy_members(const ctool& app)
205 { 229 {
206 - // Copy attributes 230 + // Copy members
  231 + m_read_ahead = app.m_read_ahead;
207 232
208 // Return 233 // Return
209 return; 234 return;
src/support/ctool.hpp
@@ -52,16 +52,38 @@ public: @@ -52,16 +52,38 @@ public:
52 // Operators 52 // Operators
53 ctool& operator=(const ctool& app); 53 ctool& operator=(const ctool& app);
54 54
  55 + // Pure virtual methods
  56 + virtual void clear(void) = 0;
  57 + virtual void run(void) = 0;
  58 + virtual void save(void) = 0;
  59 +
55 // Public methods 60 // Public methods
  61 + virtual void execute(void);
56 62
57 protected: 63 protected:
58 // Protected methods 64 // Protected methods
59 - void init_members(void);  
60 - void copy_members(const ctool& app);  
61 - void free_members(void);  
62 - GEbounds get_ebounds(void);  
63 - void set_response(GObservations& obs);  
64 - void set_obs_response(GCTAObservation* obs); 65 + void init_members(void);
  66 + void copy_members(const ctool& app);
  67 + void free_members(void);
  68 + const bool& read_ahead(void) const;
  69 + GEbounds get_ebounds(void);
  70 + void set_response(GObservations& obs);
  71 + void set_obs_response(GCTAObservation* obs);
  72 +
  73 + // Protected members
  74 + bool m_read_ahead; //!< Read ahead parameters
65 }; 75 };
66 76
  77 +
  78 +/***********************************************************************//**
  79 + * @brief Return observation container
  80 + *
  81 + * @return Reference to observation container
  82 + ***************************************************************************/
  83 +inline
  84 +const bool& ctool::read_ahead(void) const
  85 +{
  86 + return (m_read_ahead);
  87 +}
  88 +
67 #endif /* CTOOL_HPP */ 89 #endif /* CTOOL_HPP */