Commit a21ba9277b2158e7b7f450d23b703c7f2a4c300a

Authored by ldivenere
1 parent 3d85a1fb

adapted ctprob files

src/Makefile.am
@@ -40,7 +40,8 @@ SUBDIRS = support \ @@ -40,7 +40,8 @@ SUBDIRS = support \
40 cttsmap \ 40 cttsmap \
41 ctbutterfly \ 41 ctbutterfly \
42 ctulimit \ 42 ctulimit \
43 - cterror 43 + cterror \
  44 + ctprob
44 45
45 # Scripts to be distributed 46 # Scripts to be distributed
46 scripts = ctools-setup \ 47 scripts = ctools-setup \
@@ -68,7 +69,8 @@ libctools_la_LIBADD = support/libsupport.la \ @@ -68,7 +69,8 @@ libctools_la_LIBADD = support/libsupport.la \
68 cttsmap/libcttsmap.la \ 69 cttsmap/libcttsmap.la \
69 ctbutterfly/libctbutterfly.la \ 70 ctbutterfly/libctbutterfly.la \
70 ctulimit/libctulimit.la \ 71 ctulimit/libctulimit.la \
71 - cterror/libcterror.la 72 + cterror/libcterror.la \
  73 + ctprob/libctprob.la
72 libctools_la_LDFLAGS = -version-info $(CTOOLS_LT_VERSION) @OPENMP_LIB_LDFLAGS@ 74 libctools_la_LDFLAGS = -version-info $(CTOOLS_LT_VERSION) @OPENMP_LIB_LDFLAGS@
73 75
74 # Distribute scripts 76 # Distribute scripts
src/ctprob/Makefile.am
1 ############################################################################# 1 #############################################################################
2 -# Makefile.am for ctmodel tool # 2 +# Makefile.am for ctprob tool #
3 # ------------------------------------------------------------------------- # 3 # ------------------------------------------------------------------------- #
4 # Copyright (C) 2016 Juergen Knoedlseder # 4 # Copyright (C) 2016 Juergen Knoedlseder #
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
@@ -23,25 +23,25 @@ @@ -23,25 +23,25 @@
23 INCLUDES = -I$(top_srcdir)/src/support 23 INCLUDES = -I$(top_srcdir)/src/support
24 24
25 # Program name 25 # Program name
26 -bin_PROGRAMS = ctmodel 26 +bin_PROGRAMS = ctprob
27 27
28 # Sources 28 # Sources
29 -sources = ctmodel.cpp ctmodel.hpp 29 +sources = ctprob.cpp ctprob.hpp
30 30
31 # Libtool library 31 # Libtool library
32 -noinst_LTLIBRARIES = libctmodel.la  
33 -libctmodel_la_SOURCES = $(sources)  
34 -libctmodel_la_LDFLAGS = @OPENMP_LIB_LDFLAGS@ 32 +noinst_LTLIBRARIES = libctprob.la
  33 +libctprob_la_SOURCES = $(sources)
  34 +libctprob_la_LDFLAGS = @OPENMP_LIB_LDFLAGS@
35 35
36 # Program definition 36 # Program definition
37 -ctmodel_SOURCES = main.cpp  
38 -ctmodel_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@  
39 -ctmodel_CPPFLAGS = @CPPFLAGS@  
40 -ctmodel_LDADD = libctmodel.la $(top_builddir)/src/support/libsupport.la 37 +ctprob_SOURCES = main.cpp
  38 +ctprob_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@
  39 +ctprob_CPPFLAGS = @CPPFLAGS@
  40 +ctprob_LDADD = libctprob.la $(top_builddir)/src/support/libsupport.la
41 41
42 # Parameter files 42 # Parameter files
43 pfilesdir = $(prefix)/syspfiles 43 pfilesdir = $(prefix)/syspfiles
44 -pfiles_DATA = $(srcdir)/ctmodel.par 44 +pfiles_DATA = $(srcdir)/ctprob.par
45 45
46 # Extra files to be distributed in the tar file 46 # Extra files to be distributed in the tar file
47 EXTRA_DIST = $(pfiles_DATA) 47 EXTRA_DIST = $(pfiles_DATA)
src/ctprob/ctprob.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 - * ctmodel - Model cube generation tool * 2 + * ctprob - Computes probability for a given model *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2016 by Leonardo Di Venere *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -19,9 +19,9 @@ @@ -19,9 +19,9 @@
19 * * 19 * *
20 ***************************************************************************/ 20 ***************************************************************************/
21 /** 21 /**
22 - * @file ctmodel.cpp  
23 - * @brief Model cube generation tool implementation  
24 - * @author Juergen Knoedlseder 22 + * @file ctprob.cpp
  23 + * @brief Computes probability for a given model
  24 + * @author Leonardo Di Venere
25 */ 25 */
26 26
27 /* __ Includes ___________________________________________________________ */ 27 /* __ Includes ___________________________________________________________ */
@@ -29,12 +29,12 @@ @@ -29,12 +29,12 @@
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 #include <cstdio> 31 #include <cstdio>
32 -#include "ctmodel.hpp" 32 +#include "ctprob.hpp"
33 #include "GTools.hpp" 33 #include "GTools.hpp"
34 34
35 /* __ Method name definitions ____________________________________________ */ 35 /* __ Method name definitions ____________________________________________ */
36 -#define G_GET_PARAMETERS "ctmodel::get_parameters()"  
37 -#define G_FILL_CUBE "ctmodel::fill_cube(GCTAObservation*)" 36 +#define G_GET_PARAMETERS "ctprob::get_parameters()"
  37 +#define G_FILL_CUBE "ctprob::fill_cube(GCTAObservation*)"
38 38
39 /* __ Debug definitions __________________________________________________ */ 39 /* __ Debug definitions __________________________________________________ */
40 40
@@ -53,7 +53,7 @@ const GEnergy g_energy_margin(1.0e-12, &quot;TeV&quot;); @@ -53,7 +53,7 @@ const GEnergy g_energy_margin(1.0e-12, &quot;TeV&quot;);
53 /***********************************************************************//** 53 /***********************************************************************//**
54 * @brief Void constructor 54 * @brief Void constructor
55 ***************************************************************************/ 55 ***************************************************************************/
56 -ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, CTMODEL_VERSION) 56 +ctprob::ctprob(void) : ctobservation(CTPROB_NAME, CTPROB_VERSION)
57 { 57 {
58 // Initialise members 58 // Initialise members
59 init_members(); 59 init_members();
@@ -71,8 +71,8 @@ ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, CTMODEL_VERSION) @@ -71,8 +71,8 @@ ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, CTMODEL_VERSION)
71 * This method creates an instance of the class by copying an existing 71 * This method creates an instance of the class by copying an existing
72 * observations container. 72 * observations container.
73 ***************************************************************************/ 73 ***************************************************************************/
74 -ctmodel::ctmodel(const GObservations& obs) :  
75 - ctobservation(CTMODEL_NAME, CTMODEL_VERSION, obs) 74 +ctprob::ctprob(const GObservations& obs) :
  75 + ctobservation(CTPROB_NAME, CTPROB_VERSION, obs)
76 { 76 {
77 // Initialise members 77 // Initialise members
78 init_members(); 78 init_members();
@@ -89,8 +89,8 @@ ctmodel::ctmodel(const GObservations&amp; obs) : @@ -89,8 +89,8 @@ ctmodel::ctmodel(const GObservations&amp; obs) :
89 * @param[in] argc Number of arguments in command line. 89 * @param[in] argc Number of arguments in command line.
90 * @param[in] argv Array of command line arguments. 90 * @param[in] argv Array of command line arguments.
91 ***************************************************************************/ 91 ***************************************************************************/
92 -ctmodel::ctmodel(int argc, char *argv[]) :  
93 - ctobservation(CTMODEL_NAME, CTMODEL_VERSION, argc, argv) 92 +ctprob::ctprob(int argc, char *argv[]) :
  93 + ctobservation(CTPROB_NAME, CTPROB_VERSION, argc, argv)
94 { 94 {
95 // Initialise members 95 // Initialise members
96 init_members(); 96 init_members();
@@ -105,7 +105,7 @@ ctmodel::ctmodel(int argc, char *argv[]) : @@ -105,7 +105,7 @@ ctmodel::ctmodel(int argc, char *argv[]) :
105 * 105 *
106 * @param[in] app Application. 106 * @param[in] app Application.
107 ***************************************************************************/ 107 ***************************************************************************/
108 -ctmodel::ctmodel(const ctmodel& app) : ctobservation(app) 108 +ctprob::ctprob(const ctprob& app) : ctobservation(app)
109 { 109 {
110 // Initialise members 110 // Initialise members
111 init_members(); 111 init_members();
@@ -121,7 +121,7 @@ ctmodel::ctmodel(const ctmodel&amp; app) : ctobservation(app) @@ -121,7 +121,7 @@ ctmodel::ctmodel(const ctmodel&amp; app) : ctobservation(app)
121 /***********************************************************************//** 121 /***********************************************************************//**
122 * @brief Destructor 122 * @brief Destructor
123 ***************************************************************************/ 123 ***************************************************************************/
124 -ctmodel::~ctmodel(void) 124 +ctprob::~ctprob(void)
125 { 125 {
126 // Free members 126 // Free members
127 free_members(); 127 free_members();
@@ -143,7 +143,7 @@ ctmodel::~ctmodel(void) @@ -143,7 +143,7 @@ ctmodel::~ctmodel(void)
143 * @param[in] app Application. 143 * @param[in] app Application.
144 * @return Application. 144 * @return Application.
145 ***************************************************************************/ 145 ***************************************************************************/
146 -ctmodel& ctmodel::operator=(const ctmodel& app) 146 +ctprob& ctprob::operator=(const ctprob& app)
147 { 147 {
148 // Execute only if object is not identical 148 // Execute only if object is not identical
149 if (this != &app) { 149 if (this != &app) {
@@ -174,11 +174,11 @@ ctmodel&amp; ctmodel::operator=(const ctmodel&amp; app) @@ -174,11 +174,11 @@ ctmodel&amp; ctmodel::operator=(const ctmodel&amp; app)
174 ==========================================================================*/ 174 ==========================================================================*/
175 175
176 /***********************************************************************//** 176 /***********************************************************************//**
177 - * @brief Clear ctmodel tool 177 + * @brief Clear ctprob tool
178 * 178 *
179 - * Clears ctmodel tool. 179 + * Clears ctprob tool.
180 ***************************************************************************/ 180 ***************************************************************************/
181 -void ctmodel::clear(void) 181 +void ctprob::clear(void)
182 { 182 {
183 // Free members 183 // Free members
184 free_members(); 184 free_members();
@@ -208,7 +208,7 @@ void ctmodel::clear(void) @@ -208,7 +208,7 @@ void ctmodel::clear(void)
208 * observation container, loops over all CTA observations in the container 208 * observation container, loops over all CTA observations in the container
209 * and generates a model map for each CTA observation. 209 * and generates a model map for each CTA observation.
210 ***************************************************************************/ 210 ***************************************************************************/
211 -void ctmodel::run(void) 211 +void ctprob::run(void)
212 { 212 {
213 // If we're in debug mode then all output is also dumped on the screen 213 // If we're in debug mode then all output is also dumped on the screen
214 if (logDebug()) { 214 if (logDebug()) {
@@ -296,7 +296,7 @@ void ctmodel::run(void) @@ -296,7 +296,7 @@ void ctmodel::run(void)
296 * Saves the model cube into a FITS file specified using the "outfile" 296 * Saves the model cube into a FITS file specified using the "outfile"
297 * task parameter. 297 * task parameter.
298 ***************************************************************************/ 298 ***************************************************************************/
299 -void ctmodel::save(void) 299 +void ctprob::save(void)
300 { 300 {
301 // Write header 301 // Write header
302 log_header1(TERSE, "Save model cube"); 302 log_header1(TERSE, "Save model cube");
@@ -326,7 +326,7 @@ void ctmodel::save(void) @@ -326,7 +326,7 @@ void ctmodel::save(void)
326 * 326 *
327 * @param[in] name Model cube name. 327 * @param[in] name Model cube name.
328 ***************************************************************************/ 328 ***************************************************************************/
329 -void ctmodel::publish(const std::string& name) 329 +void ctprob::publish(const std::string& name)
330 { 330 {
331 // Write header into logger 331 // Write header into logger
332 log_header1(TERSE, "Publish model cube"); 332 log_header1(TERSE, "Publish model cube");
@@ -334,7 +334,7 @@ void ctmodel::publish(const std::string&amp; name) @@ -334,7 +334,7 @@ void ctmodel::publish(const std::string&amp; name)
334 // Set default name is user name is empty 334 // Set default name is user name is empty
335 std::string user_name(name); 335 std::string user_name(name);
336 if (user_name.empty()) { 336 if (user_name.empty()) {
337 - user_name = CTMODEL_NAME; 337 + user_name = CTPROB_NAME;
338 } 338 }
339 339
340 // Log filename 340 // Log filename
@@ -355,7 +355,7 @@ void ctmodel::publish(const std::string&amp; name) @@ -355,7 +355,7 @@ void ctmodel::publish(const std::string&amp; name)
355 * 355 *
356 * Set model cube and set all cube bins to zero. 356 * Set model cube and set all cube bins to zero.
357 ***************************************************************************/ 357 ***************************************************************************/
358 -void ctmodel::cube(const GCTAEventCube& cube) 358 +void ctprob::cube(const GCTAEventCube& cube)
359 { 359 {
360 // Set cube 360 // Set cube
361 m_cube = cube; 361 m_cube = cube;
@@ -382,7 +382,7 @@ void ctmodel::cube(const GCTAEventCube&amp; cube) @@ -382,7 +382,7 @@ void ctmodel::cube(const GCTAEventCube&amp; cube)
382 /***********************************************************************//** 382 /***********************************************************************//**
383 * @brief Initialise class members 383 * @brief Initialise class members
384 ***************************************************************************/ 384 ***************************************************************************/
385 -void ctmodel::init_members(void) 385 +void ctprob::init_members(void)
386 { 386 {
387 // Initialise members 387 // Initialise members
388 m_outcube.clear(); 388 m_outcube.clear();
@@ -407,7 +407,7 @@ void ctmodel::init_members(void) @@ -407,7 +407,7 @@ void ctmodel::init_members(void)
407 * 407 *
408 * @param[in] app Application. 408 * @param[in] app Application.
409 ***************************************************************************/ 409 ***************************************************************************/
410 -void ctmodel::copy_members(const ctmodel& app) 410 +void ctprob::copy_members(const ctprob& app)
411 { 411 {
412 // Copy attributes 412 // Copy attributes
413 m_outcube = app.m_outcube; 413 m_outcube = app.m_outcube;
@@ -430,7 +430,7 @@ void ctmodel::copy_members(const ctmodel&amp; app) @@ -430,7 +430,7 @@ void ctmodel::copy_members(const ctmodel&amp; app)
430 /***********************************************************************//** 430 /***********************************************************************//**
431 * @brief Delete class members 431 * @brief Delete class members
432 ***************************************************************************/ 432 ***************************************************************************/
433 -void ctmodel::free_members(void) 433 +void ctprob::free_members(void)
434 { 434 {
435 // Return 435 // Return
436 return; 436 return;
@@ -443,7 +443,7 @@ void ctmodel::free_members(void) @@ -443,7 +443,7 @@ void ctmodel::free_members(void)
443 * Get all task parameters from parameter file or (if required) by querying 443 * Get all task parameters from parameter file or (if required) by querying
444 * the user. The parameters are read in the correct order. 444 * the user. The parameters are read in the correct order.
445 ***************************************************************************/ 445 ***************************************************************************/
446 -void ctmodel::get_parameters(void) 446 +void ctprob::get_parameters(void)
447 { 447 {
448 // Reset cube append flag 448 // Reset cube append flag
449 m_append_cube = false; 449 m_append_cube = false;
@@ -598,7 +598,7 @@ void ctmodel::get_parameters(void) @@ -598,7 +598,7 @@ void ctmodel::get_parameters(void)
598 * 598 *
599 * @todo Support stacked energy dispersion 599 * @todo Support stacked energy dispersion
600 ***************************************************************************/ 600 ***************************************************************************/
601 -void ctmodel::get_obs(void) 601 +void ctprob::get_obs(void)
602 { 602 {
603 // Get the filename from the input parameters 603 // Get the filename from the input parameters
604 std::string filename = (*this)["inobs"].filename(); 604 std::string filename = (*this)["inobs"].filename();
@@ -723,7 +723,7 @@ void ctmodel::get_obs(void) @@ -723,7 +723,7 @@ void ctmodel::get_obs(void)
723 * GTI of the model cube so that cube GTI is a list of the GTIs of all 723 * GTI of the model cube so that cube GTI is a list of the GTIs of all
724 * observations that were used to generate the model cube. 724 * observations that were used to generate the model cube.
725 ***************************************************************************/ 725 ***************************************************************************/
726 -void ctmodel::fill_cube(const GCTAObservation* obs) 726 +void ctprob::fill_cube(const GCTAObservation* obs)
727 { 727 {
728 // Get references to GTI and energy boundaries for the event list 728 // Get references to GTI and energy boundaries for the event list
729 const GGti& gti = obs->events()->gti(); 729 const GGti& gti = obs->events()->gti();
src/ctprob/ctprob.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 - * ctmodel - Model cube generation tool * 2 + * ctprob - Computes probability for a given model *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2016 by Leonardo Di Venere *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -19,11 +19,12 @@ @@ -19,11 +19,12 @@
19 * * 19 * *
20 ***************************************************************************/ 20 ***************************************************************************/
21 /** 21 /**
22 - * @file ctmodel.hpp  
23 - * @brief Model cube generation tool definition  
24 - * @author Juergen Knoedlseder 22 + * @file ctprob.hpp
  23 + * @brief Computes probability for a given model
  24 + * @author Leonardo Di Venere
25 */ 25 */
26 26
  27 +
27 #ifndef CTMODEL_HPP 28 #ifndef CTMODEL_HPP
28 #define CTMODEL_HPP 29 #define CTMODEL_HPP
29 30
src/ctprob/ctprob.par
@@ -4,13 +4,13 @@ @@ -4,13 +4,13 @@
4 # # 4 # #
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 -# File: ctmodel.par # 7 +# File: ctprob.par #
8 # # 8 # #
9 -# Author: Juergen Knoedlseder #  
10 -# Jurgen.Knodlseder@irap.omp.eu #  
11 -# IRAP # 9 +# Author: Leonardo Di Venere #
  10 +# leonardo.divenere@ba.infn.it #
  11 +# INFN #
12 # # 12 # #
13 -# Purpose: Parameter file for the ctmodel application # 13 +# Purpose: Parameter file for the ctprob application #
14 # # 14 # #
15 ############################################################################# 15 #############################################################################
16 # 16 #
@@ -67,4 +67,4 @@ chatter, i, h, 2,0,4, &quot;Chattiness of output&quot; @@ -67,4 +67,4 @@ chatter, i, h, 2,0,4, &quot;Chattiness of output&quot;
67 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 67 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
68 debug, b, h, no,,, "Debugging mode activated" 68 debug, b, h, no,,, "Debugging mode activated"
69 mode, s, h, "ql",,, "Mode of automatic parameters" 69 mode, s, h, "ql",,, "Mode of automatic parameters"
70 -logfile, f, h, "ctmodel.log",,, "Log filename" 70 +logfile, f, h, "ctprob.log",,, "Log filename"
src/ctprob/main.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 - * ctmodel - CTA counts model tool * 2 + * ctprob - Computes probability for a given model *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2016 by Leonardo Di Venere *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -19,9 +19,9 @@ @@ -19,9 +19,9 @@
19 * * 19 * *
20 ***************************************************************************/ 20 ***************************************************************************/
21 /** 21 /**
22 - * @file ctmodel/main.cpp  
23 - * @brief CTA counts model tool main code  
24 - * @author Juergen Knoedlseder 22 + * @file main.cpp
  23 + * @brief Computes probability for a given model
  24 + * @author Leonardo Di Venere
25 */ 25 */
26 26
27 /* __ Includes ___________________________________________________________ */ 27 /* __ Includes ___________________________________________________________ */