ctools 2.1.0
Loading...
Searching...
No Matches
ctlikelihood Class Referenceabstract

Base class for likelihood tools. More...

#include <ctlikelihood.hpp>

Inheritance diagram for ctlikelihood:
ctobservation ctool GApplication ctbutterfly cterror ctlike cttsmap ctulimit

Public Member Functions

 ctlikelihood (const std::string &name, const std::string &version)
 Name constructor.
 
 ctlikelihood (const std::string &name, const std::string &version, const GApplicationPars &pars)
 Application parameters constructor.
 
 ctlikelihood (const std::string &name, const std::string &version, int argc, char *argv[])
 Command line constructor.
 
 ctlikelihood (const std::string &name, const std::string &version, const GObservations &obs)
 Observations constructor.
 
 ctlikelihood (const ctlikelihood &app)
 Copy constructor.
 
virtual ~ctlikelihood (void)
 Destructor.
 
ctlikelihoodoperator= (const ctlikelihood &app)
 Assignment operator.
 
virtual void clear (void)=0
 
virtual void process (void)=0
 
virtual void save (void)=0
 
void opt (const GOptimizer *opt)
 Set optimizer.
 
const GOptimizer * opt (void) const
 Return optimizer.
 
- Public Member Functions inherited from ctobservation
 ctobservation (const std::string &name, const std::string &version)
 Name constructor.
 
 ctobservation (const std::string &name, const std::string &version, const GApplicationPars &pars)
 Application parameters constructor.
 
 ctobservation (const std::string &name, const std::string &version, int argc, char *argv[])
 Command line constructor.
 
 ctobservation (const std::string &name, const std::string &version, const GObservations &obs)
 Observations constructor.
 
 ctobservation (const ctobservation &app)
 Copy constructor.
 
virtual ~ctobservation (void)
 Destructor.
 
ctobservationoperator= (const ctobservation &app)
 Assignment operator.
 
void obs (const GObservations &obs)
 Set observation container.
 
const GObservations & obs (void) const
 Return observation container.
 
- Public Member Functions inherited from ctool
 ctool (const std::string &name, const std::string &version)
 Name constructor.
 
 ctool (const std::string &name, const std::string &version, const GApplicationPars &pars)
 Application parameter constructor.
 
 ctool (const std::string &name, const std::string &version, int argc, char *argv[])
 Command line constructor.
 
 ctool (const ctool &app)
 Copy constructor.
 
virtual ~ctool (void)
 Destructor.
 
ctooloperator= (const ctool &app)
 Assignment operator.
 
virtual void run (void)
 Run ctool.
 
virtual void execute (void)
 Execute ctool.
 

Protected Member Functions

double evaluate (GModelPar &par, const double &value)
 Evaluates the log-likelihood function.
 
void init_members (void)
 Initialise class members.
 
void copy_members (const ctlikelihood &app)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
- Protected Member Functions inherited from ctobservation
GCTAObservation * first_unbinned_observation (void)
 Return first unbinned CTA observation.
 
GCTAObservation * next_unbinned_observation (void)
 Return next unbinned CTA observation.
 
const GCTAObservation * first_unbinned_observation (void) const
 Return first unbinned CTA observation (const version)
 
const GCTAObservation * next_unbinned_observation (void) const
 Return next unbinned CTA observation (const version)
 
void read_ogip_keywords (GFitsHDU *hdu) const
 Read OGIP keywords from FITS HDU.
 
void write_ogip_keywords (GFitsHDU *hdu) const
 Write OGIP keywords in FITS HDU.
 
void set_obs_statistic (const std::string &statistic)
 Set fit statistic for CTA observations.
 
void set_obs_bounds ()
 Set observation boundaries for CTA observations.
 
void save_events_fits (void)
 Save event list in FITS format.
 
void save_events_xml (void)
 Save event list(s) in XML format.
 
void init_members (void)
 Initialise class members.
 
void copy_members (const ctobservation &app)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
- Protected Member Functions inherited from ctool
void init_members (void)
 Initialise class members.
 
void copy_members (const ctool &app)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
void sync_pfiles (void)
 Synchronise parameter files.
 
const bool & read_ahead (void) const
 Signal whether parameters should be read ahead.
 
void setup_observations (GObservations &obs, const bool &response=true, const bool &list=true, const bool &cube=true)
 Setup observation container.
 
void setup_models (GObservations &obs, const std::string &name="")
 Setup model container.
 
GEbounds create_ebounds (void)
 Create energy boundaries from user parameters.
 
GEnergies create_energies (void)
 Create energies from user parameters.
 
GSkyMap create_map (const GObservations &obs)
 Create a skymap from user parameters.
 
GCTAEventCube create_cube (const GObservations &obs)
 Create a CTA event cube from user parameters.
 
GCTAObservation create_cta_obs (void)
 Create a CTA observation from User parameters.
 
void require_inobs (const std::string &method)
 Throws exception if inobs parameter is not valid.
 
void require_inobs_nolist (const std::string &method)
 
void require_inobs_nocube (const std::string &method)
 Throws exception if inobs parameter is a counts cube.
 
GCTARoi get_roi (const GCTAPointing &pnt=GCTAPointing())
 Return RoI from User parameters.
 
GEbounds get_ebounds (void)
 Return energy boundaries from User parameters.
 
GGti get_gti (const GTimeReference &ref)
 Return Good Time Intervals from User parameter.
 
GCTAPointing get_pointing (void)
 Return CTA pointing from User parameters.
 
GSkyDir get_skydir (void)
 Return sky direction from User parameters.
 
std::string set_outfile_name (const std::string &filename)
 Set output file name.
 
bool is_stacked (void)
 Query user parameters for stacked analysis.
 
bool is_onoff (void)
 Query user parameters for On/Off analysis.
 
void log_parameters (const GChatter &chatter)
 Log application parameters.
 
void log_observations (const GChatter &chatter, const GObservations &obs, const std::string &what="Observation")
 Log observation container.
 
void log_models (const GChatter &chatter, const GModels &models, const std::string &what="Model")
 Log model container.
 
void set_response (GObservations &obs)
 Set response for all CTA observations in container.
 
std::vector< bool > set_edisp (GObservations &obs, const bool &edisp) const
 Set energy dispersion to CTA observations.
 
void restore_edisp (GObservations &obs, const std::vector< bool > &edisp) const
 Restore energy dispersion flags of CTA observations.
 
void set_obs_response (GCTAObservation *obs)
 Set response for CTA observation.
 
GObservations get_observations (const bool &get_response=true)
 Get observation container.
 
GSkyDir get_mean_pointing (const GObservations &obs)
 Derives mean pointing from CTA observations.
 
size_t get_current_rss (void)
 Get current resident set size (physical memory use) in Bytes.
 
std::string get_obs_header (const GObservation *obs) const
 Return observation header string.
 
GEnergies insert_energy_boundaries (const GEnergies &energies, const GCTAObservation &obs)
 Insert observation energy boundaries into list of energies.
 
std::vector< bool > cube_layer_usage (const GEbounds &cube_ebounds, const GEbounds &list_ebounds) const
 Determine the counts cube layer usage.
 
std::string get_gtiname (const std::string &filename, const std::string &evtname) const
 Get Good Time Intervals extension name.
 
void save_event_list (const GCTAObservation *obs, const std::string &infile, const std::string &evtname, const std::string &gtiname, const std::string &outfile) const
 Save event list into FITS file.
 
std::string warn_too_few_energies (const GEnergies &energies) const
 Set warning string if there are too few energies.
 
std::string warn_xml_suffix (const GFilename &filename) const
 Set warning string if file has no .xml suffix.
 
void provide_help (void) const
 Dump help text in the console.
 

Protected Attributes

GOptimizerLM m_opt
 Optimizer.
 
- Protected Attributes inherited from ctobservation
GObservations m_obs
 Observation container.
 
- Protected Attributes inherited from ctool
bool m_read_ahead
 Read ahead output parameters.
 
bool m_use_xml
 Use XML file instead of FITS file for observations.
 

Detailed Description

Base class for likelihood tools.

Definition at line 41 of file ctlikelihood.hpp.

Constructor & Destructor Documentation

◆ ctlikelihood() [1/5]

ctlikelihood::ctlikelihood ( const std::string & name,
const std::string & version )

Name constructor.

Parameters
[in]nameLikelihood tool name.
[in]versionLikelihood tool version.

Constructs a likelihood tool from the name and version. See the equivalent ctool constructor for details.

Definition at line 59 of file ctlikelihood.cpp.

References init_members().

◆ ctlikelihood() [2/5]

ctlikelihood::ctlikelihood ( const std::string & name,
const std::string & version,
const GApplicationPars & pars )

Application parameters constructor.

Parameters
[in]nameObservation tool name.
[in]versionObservation tool version.
[in]parsApplication parameters.

Constructs a likelihood tool from the name, version and the application parameters pars. See the equivalent ctool constructor for details.

Definition at line 82 of file ctlikelihood.cpp.

References init_members().

◆ ctlikelihood() [3/5]

ctlikelihood::ctlikelihood ( const std::string & name,
const std::string & version,
int argc,
char * argv[] )

Command line constructor.

Parameters
[in]nameLikelihood tool name.
[in]versionLikelihood tool version.
[in]argcNumber of arguments in command line.
[in]argvArray of command line arguments.

Constructs a likelihood tool from the name, version and command line arguments. See the equivalent ctool constructor for details.

Definition at line 106 of file ctlikelihood.cpp.

References init_members().

◆ ctlikelihood() [4/5]

ctlikelihood::ctlikelihood ( const std::string & name,
const std::string & version,
const GObservations & obs )

Observations constructor.

Parameters
[in]nameLikelihood tool name.
[in]versionLikelihood tool version.
[in]obsObservation container.

Constructs a likelihood tool from the name, version and an observation container.

Definition at line 130 of file ctlikelihood.cpp.

References init_members().

◆ ctlikelihood() [5/5]

ctlikelihood::ctlikelihood ( const ctlikelihood & app)

Copy constructor.

Parameters
[in]appLikelihood tool.

Constructs an instance of a likelihood tool by copying information from another likelihood tool.

Definition at line 151 of file ctlikelihood.cpp.

References copy_members(), and init_members().

◆ ~ctlikelihood()

ctlikelihood::~ctlikelihood ( void )
virtual

Destructor.

Destructs the likelihood tool.

Definition at line 169 of file ctlikelihood.cpp.

References free_members().

Member Function Documentation

◆ clear()

virtual void ctlikelihood::clear ( void )
pure virtual

Implements ctobservation.

Implemented in ctbutterfly, cterror, ctlike, cttsmap, and ctulimit.

◆ copy_members()

void ctlikelihood::copy_members ( const ctlikelihood & app)
protected

Copy class members.

Parameters
[in]appLikelihood tool.

Definition at line 351 of file ctlikelihood.cpp.

References m_opt.

Referenced by ctlikelihood(), and operator=().

◆ evaluate()

double ctlikelihood::evaluate ( GModelPar & par,
const double & value )
protected

Evaluates the log-likelihood function.

Parameters
[in]parModel parameter
[in]valueModel parameter factor value
Returns
Log-likelihood function

Evaluates the log-likelihood function at a given value.

Definition at line 271 of file ctlikelihood.cpp.

References G_EVALUATE, ctobservation::m_obs, and m_opt.

Referenced by cterror::error_bisection(), ctulimit::get_parameter_brackets(), and ctulimit::ulimit_bisection().

◆ free_members()

void ctlikelihood::free_members ( void )
protected

◆ init_members()

void ctlikelihood::init_members ( void )
protected

◆ operator=()

ctlikelihood & ctlikelihood::operator= ( const ctlikelihood & app)

Assignment operator.

Parameters
[in]appLikelihood tool.
Returns
Likelihood tool.

Assigns a likelihood tool.

Definition at line 193 of file ctlikelihood.cpp.

References copy_members(), free_members(), init_members(), and ctobservation::operator=().

Referenced by ctbutterfly::operator=(), cterror::operator=(), ctlike::operator=(), cttsmap::operator=(), and ctulimit::operator=().

◆ opt() [1/2]

void ctlikelihood::opt ( const GOptimizer * opt)

Set optimizer.

Parameters
[in]optPointer to optimizer.
Exceptions
GException::invalid_argumentSpecified optimizer is not of type GOptimizerLM.

Sets the optimizer. So far only optimizers of type GOptimizerLM are supported. If a different optimizer is specified the method throws an exception.

Definition at line 235 of file ctlikelihood.cpp.

References G_OPT, m_opt, and opt().

Referenced by cscripts.cstsmapsplit.cstsmapsplit::_compute_null_hypothesis().

◆ opt() [2/2]

const GOptimizer * ctlikelihood::opt ( void ) const
inline

Return optimizer.

Returns
Pointer to optimizer.

Returns a pointer to the optimizer.

Definition at line 97 of file ctlikelihood.hpp.

References m_opt.

Referenced by cscripts.cstsmapsplit.cstsmapsplit::_compute_null_hypothesis(), opt(), ctlike::refit(), and ctlike::reoptimize_lm().

◆ process()

virtual void ctlikelihood::process ( void )
pure virtual

Implements ctobservation.

Implemented in ctbutterfly, cterror, ctlike, cttsmap, and ctulimit.

◆ save()

virtual void ctlikelihood::save ( void )
pure virtual

Implements ctobservation.

Implemented in ctbutterfly, cterror, ctlike, cttsmap, and ctulimit.

Member Data Documentation

◆ m_opt


The documentation for this class was generated from the following files: