|
GammaLib 2.2.0.dev
|
Fermi/LAT observation class. More...
#include <GLATObservation.hpp>
Public Member Functions | |
| GLATObservation (void) | |
| Void constructor. | |
| GLATObservation (const GXmlElement &xml) | |
| XML constructor. | |
| GLATObservation (const GLATObservation &obs) | |
| Copy constructor. | |
| virtual | ~GLATObservation (void) |
| Destructor. | |
| GLATObservation & | operator= (const GLATObservation &obs) |
| Assignment operator. | |
| virtual void | clear (void) |
| Clear Fermi/LAT observation. | |
| virtual GLATObservation * | clone (void) const |
| Clone Fermi/LAT observation. | |
| virtual std::string | classname (void) const |
| Return class name. | |
| virtual void | response (const GResponse &rsp) |
| Set response function. | |
| virtual const GLATResponse * | response (void) const |
| Return Fermi/LAT response function. | |
| virtual std::string | instrument (void) const |
| Return instrument name. | |
| virtual double | ontime (void) const |
| Return ontime. | |
| virtual double | livetime (void) const |
| Return livetime. | |
| virtual double | deadc (const GTime &time=GTime()) const |
| Return deadtime correction factor. | |
| virtual void | read (const GXmlElement &xml) |
| Read observation from XML element. | |
| virtual void | write (GXmlElement &xml) const |
| Write observation into XML element. | |
| virtual std::string | print (const GChatter &chatter=NORMAL) const |
| Print LAT observation information. | |
| void | load_unbinned (const std::string &ft1name, const std::string &ft2name, const std::string <cube_name) |
| Load data for unbinned analysis. | |
| void | load_binned (const std::string &cntmap_name, const std::string &expmap_name, const std::string <cube_name) |
| Load data for binned analysis. | |
| void | response (const std::string &irfname) |
| Set response function. | |
| const GLATLtCube * | ltcube (void) const |
| Return Fermi/LAT livetime cube. | |
Public Member Functions inherited from GObservation | |
| GObservation (void) | |
| Void constructor. | |
| GObservation (const GObservation &obs) | |
| Copy constructor. | |
| virtual | ~GObservation (void) |
| Destructor. | |
| virtual GObservation & | operator= (const GObservation &obs) |
| Assignment operator. | |
| virtual GEvents * | events (void) |
| Return events. | |
| virtual const GEvents * | events (void) const |
| Return events (const version) | |
| virtual void | events (const GEvents &events) |
| Set event container. | |
| virtual double | likelihood (const GModels &models, GVector *gradients, GMatrixSparse *curvature, double *npred) const |
| Compute likelihood function. | |
| virtual double | model (const GModels &models, const GEvent &event, GVector *gradients=NULL) const |
| Return model value and (optionally) gradients. | |
| virtual GVector | model (const GModels &models, GMatrixSparse *gradients=NULL) const |
| Return vector of model values and (optionally) gradients. | |
| virtual double | nobserved (void) const |
| Return total number of observed events. | |
| virtual double | npred (const GModels &models, GVector *gradients=NULL) const |
| Return total number (and optionally gradients) of predicted counts for all models. | |
| virtual double | npred (const GModel &model) const |
| Return total number of predicted counts for one model. | |
| virtual double | model_grad (const GModel &model, const GModelPar &par, const GEvent &event) const |
| Returns parameter gradient of model for a given event. | |
| virtual GVector | model_grad (const GModel &model, const GModelPar &par) const |
| Returns parameter gradients of model for all events. | |
| virtual double | npred_grad (const GModel &model, const GModelPar &par) const |
| Returns parameter gradient of Npred. | |
| virtual void | remove_response_cache (const std::string &name) |
| Remove response cache for specific model. | |
| virtual double | grad_step_size (const GModelPar &par) const |
| Return gradient step size for a given model parameter. | |
| bool | has_events (void) const |
| Signal if observation has events. | |
| bool | has_gradient (const GModel &model, const GModelPar &par) const |
| Check whether a model parameter has an analytical gradient. | |
| void | name (const std::string &name) |
| Set observation name. | |
| void | id (const std::string &id) |
| Set observation identifier. | |
| void | statistic (const std::string &statistic) |
| Set optimizer statistic. | |
| const std::string & | name (void) const |
| Return observation name. | |
| const std::string & | id (void) const |
| Return observation identifier. | |
| const std::string & | statistic (void) const |
| Return optimizer statistic. | |
| void | computed_gradient (const GModel &model, const GModelPar &par) const |
| Signals that an analytical gradient was computed for a model parameter. | |
Public Member Functions inherited from GBase | |
| virtual | ~GBase (void) |
| Destructor. | |
Protected Member Functions | |
| void | init_members (void) |
| Initialise class members. | |
| void | copy_members (const GLATObservation &obs) |
| Copy class members. | |
| void | free_members (void) |
| Delete class members. | |
Protected Member Functions inherited from GObservation | |
| void | init_members (void) |
| Initialise class members. | |
| void | copy_members (const GObservation &obs) |
| Copy class members. | |
| void | free_members (void) |
| Delete class members. | |
| virtual double | likelihood_poisson_unbinned (const GModels &models, GVector *gradients, GMatrixSparse *curvature, double *npred) const |
| Evaluate log-likelihood function for Poisson statistic and unbinned analysis (version with working arrays) | |
| virtual double | likelihood_poisson_binned (const GModels &models, GVector *gradients, GMatrixSparse *curvature, double *npred) const |
| Evaluate log-likelihood function for Poisson statistic and binned analysis (version with working arrays) | |
| virtual double | likelihood_gaussian_binned (const GModels &models, GVector *gradients, GMatrixSparse *curvature, double *npred) const |
| Evaluate log-likelihood function for Gaussian statistic and binned analysis (version with working arrays) | |
| virtual bool | use_event_for_likelihood (const int &index) const |
| Check whether bin should be used for likelihood analysis. | |
| virtual double | npred_spec (const GModel &model, const GTime &obsTime) const |
| Integrates spatially integrated Npred kernel spectrally. | |
Protected Attributes | |
| std::string | m_ft1file |
| FT1 filename. | |
| std::string | m_ft2file |
| FT2 filename. | |
| std::string | m_ltfile |
| Lifetime cube filename. | |
| std::string | m_cntfile |
| Counts map filename. | |
| std::string | m_expfile |
| Exposure map filename. | |
| GLATResponse | m_response |
| Instrument response functions. | |
| GLATLtCube * | m_ltcube |
| Pointer to livetime cube. | |
Protected Attributes inherited from GObservation | |
| std::string | m_name |
| Observation name. | |
| std::string | m_id |
| Observation identifier. | |
| std::string | m_statistic |
| Optimizer statistic. | |
| GEvents * | m_events |
| Pointer to event container. | |
| std::vector< std::string > | m_pars_with_gradients |
Fermi/LAT observation class.
This class implements a Fermi/LAT observation.
Definition at line 49 of file GLATObservation.hpp.
| GLATObservation::GLATObservation | ( | void | ) |
Void constructor.
Definition at line 67 of file GLATObservation.cpp.
References init_members().
Referenced by clone().
|
explicit |
XML constructor.
| [in] | xml | XML element. |
Constructs a LAT observation from the information that is found in an XML element.
Definition at line 85 of file GLATObservation.cpp.
References init_members(), and read().
| GLATObservation::GLATObservation | ( | const GLATObservation & | obs | ) |
Copy constructor.
| [in] | obs | LAT observation. |
Definition at line 103 of file GLATObservation.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GObservation.
Definition at line 108 of file GLATObservation.hpp.
|
virtual |
Clear Fermi/LAT observation.
Implements GObservation.
Definition at line 174 of file GLATObservation.cpp.
References free_members(), GObservation::free_members(), init_members(), and GObservation::init_members().
Referenced by read().
|
virtual |
Clone Fermi/LAT observation.
Implements GObservation.
Definition at line 194 of file GLATObservation.cpp.
References GLATObservation().
|
protected |
Copy class members.
| [in] | obs | LAT observation. |
Definition at line 719 of file GLATObservation.cpp.
References GLATLtCube::clone(), m_cntfile, m_expfile, m_ft1file, m_ft2file, m_ltcube, m_ltfile, and m_response.
Referenced by GLATObservation(), and operator=().
Return deadtime correction factor.
Implements GObservation.
Definition at line 185 of file GLATObservation.hpp.
|
protected |
Delete class members.
Definition at line 740 of file GLATObservation.cpp.
References m_ltcube.
Referenced by clear(), operator=(), and ~GLATObservation().
|
protected |
Initialise class members.
Definition at line 698 of file GLATObservation.cpp.
References GLATResponse::clear(), m_cntfile, m_expfile, m_ft1file, m_ft2file, m_ltcube, m_ltfile, and m_response.
Referenced by clear(), GLATObservation(), GLATObservation(), GLATObservation(), and operator=().
|
inlinevirtual |
Return instrument name.
Implements GObservation.
Definition at line 146 of file GLATObservation.hpp.
Referenced by print().
|
inlinevirtual |
Return livetime.
Implements GObservation.
Definition at line 172 of file GLATObservation.hpp.
Referenced by print().
| void GLATObservation::load_binned | ( | const std::string & | cntmap_name, |
| const std::string & | expmap_name, | ||
| const std::string & | ltcube_name ) |
Load data for binned analysis.
| [in] | cntmap_name | Counts map or Source map FITS filename |
| [in] | expmap_name | Binned explosure map FITS filename |
| [in] | ltcube_name | Livetime cube FITS filename |
Definition at line 653 of file GLATObservation.cpp.
References GObservation::events(), GEvents::load(), GLATLtCube::load(), m_cntfile, GObservation::m_events, m_expfile, m_ltcube, and m_ltfile.
Referenced by read().
| void GLATObservation::load_unbinned | ( | const std::string & | ft1name, |
| const std::string & | ft2name, | ||
| const std::string & | ltcube_name ) |
Load data for unbinned analysis.
| [in] | ft1name | FT1 FITS filename. |
| [in] | ft2name | FT2 FITS filename. |
| [in] | ltcube_name | Livetime cube FITS filename |
Definition at line 599 of file GLATObservation.cpp.
References GFits::close(), GObservation::events(), GLATLtCube::load(), GObservation::m_events, m_ft1file, m_ft2file, m_ltcube, m_ltfile, and GEvents::read().
Referenced by read().
|
inline |
Return Fermi/LAT livetime cube.
Definition at line 133 of file GLATObservation.hpp.
References m_ltcube.
Referenced by GLATMeanPsf::set().
|
inlinevirtual |
Return ontime.
Implements GObservation.
Definition at line 159 of file GLATObservation.hpp.
Referenced by print().
| GLATObservation & GLATObservation::operator= | ( | const GLATObservation & | obs | ) |
Assignment operator.
| [in] | obs | Fermi/LAT observation. |
Definition at line 141 of file GLATObservation.cpp.
References copy_members(), free_members(), init_members(), and GObservation::operator=().
Print LAT observation information.
| [in] | chatter | Chattiness. |
Implements GObservation.
Definition at line 538 of file GLATObservation.cpp.
References instrument(), livetime(), GObservation::m_events, m_ltcube, m_response, GObservation::name(), ontime(), gammalib::parformat(), GEvents::print(), GLATLtCube::print(), GLATResponse::print(), gammalib::reduce(), SILENT, GObservation::statistic(), and gammalib::str().
|
virtual |
Read observation from XML element.
| [in] | xml | XML element. |
| GException::invalid_value | Invalid parameter names found in XML element. |
Reads information for a LAT observation from an XML element. The expected format of the XML element is
<observation name="..." id="..." instrument="LAT"> <parameter name="FT1" file="..."/> <parameter name="FT2" file="..."/> <parameter name="LiveTimeCube" file="..."/> <parameter name="IRF" file="..."/> </observation>
for an unbinned observation and
<observation name="..." id="..." instrument="LAT"> <parameter name="CountsMap" file="..."/> <parameter name="ExposureMap" file="..."/> <parameter name="LiveTimeCube" file="..."/> <parameter name="IRF" value="..."/> </observation>
for a binned observation.
Implements GObservation.
Definition at line 292 of file GLATObservation.cpp.
References GXmlElement::attribute(), clear(), GXmlNode::element(), GXmlNode::elements(), G_READ, load_binned(), load_unbinned(), response(), gammalib::xml_check_parnum(), and gammalib::xml_file_expand().
Referenced by GLATObservation().
|
virtual |
Set response function.
| [in] | rsp | Response function. |
| GException::invalid_argument | Response rsp in not a LAT response. |
Sets the response function for the observation. The argument has to be of type GLATResponse, otherwise an exception is thrown.
Implements GObservation.
Definition at line 211 of file GLATObservation.cpp.
References G_RESPONSE, m_response, and GObservation::name().
Referenced by GLATMeanPsf::set().
| void GLATObservation::response | ( | const std::string & | irfname | ) |
Set response function.
| [in] | irfname | Name of instrument response function. |
Set the LAT response function using the IRF name and the path to the calibration database. The IRF name has to be one of
name (is equivalent to front+back) name::front name::back name::psf(0-3) name::edisp(0-3)
where name is the response name (for example "P8R2_SOURCE_V6"). Note that the name is case sensitive, but the event typ is not case sensitive.
Definition at line 250 of file GLATObservation.cpp.
References GLATResponse::clear(), GLATResponse::load(), and m_response.
|
inlinevirtual |
Return Fermi/LAT response function.
Implements GObservation.
Definition at line 120 of file GLATObservation.hpp.
References m_response.
Referenced by read().
|
virtual |
Write observation into XML element.
| [in] | xml | XML element. |
| GException::invalid_value | No events allocated or invalid parameter names found in XML element.. |
| GException::runtime_error | Non-LAT events encountered. |
Writes information for a LAT observation into an XML element. The expected format of the XML element is
<observation name="..." id="..." instrument="LAT"> <parameter name="FT1" file="..."/> <parameter name="FT2" file="..."/> <parameter name="LiveTimeCube" file="..."/> <parameter name="IRF" file="..."/> </observation>
for an unbinned observation and
<observation name="..." id="..." instrument="LAT"> <parameter name="CountsMap" file="..."/> <parameter name="ExposureMap" file="..."/> <parameter name="LiveTimeCube" file="..."/> <parameter name="IRF" value="..."/> </observation>
for a binned observation.
Implements GObservation.
Definition at line 429 of file GLATObservation.cpp.
References GXmlNode::append(), GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), G_WRITE, m_cntfile, GObservation::m_events, m_expfile, m_ft1file, m_ft2file, m_ltfile, m_response, GObservation::name(), GLATResponse::rspname(), gammalib::xml_check_parnum(), and gammalib::xml_file_reduce().
|
protected |
Counts map filename.
Definition at line 95 of file GLATObservation.hpp.
Referenced by copy_members(), init_members(), load_binned(), and write().
|
protected |
Exposure map filename.
Definition at line 96 of file GLATObservation.hpp.
Referenced by copy_members(), init_members(), load_binned(), and write().
|
protected |
FT1 filename.
Definition at line 92 of file GLATObservation.hpp.
Referenced by copy_members(), init_members(), load_unbinned(), and write().
|
protected |
FT2 filename.
Definition at line 93 of file GLATObservation.hpp.
Referenced by copy_members(), init_members(), load_unbinned(), and write().
|
protected |
Pointer to livetime cube.
Definition at line 98 of file GLATObservation.hpp.
Referenced by copy_members(), free_members(), init_members(), load_binned(), load_unbinned(), ltcube(), and print().
|
protected |
Lifetime cube filename.
Definition at line 94 of file GLATObservation.hpp.
Referenced by copy_members(), init_members(), load_binned(), load_unbinned(), and write().
|
protected |
Instrument response functions.
Definition at line 97 of file GLATObservation.hpp.
Referenced by copy_members(), init_members(), print(), response(), response(), response(), and write().