GammaLib
2.1.0.dev
|
Fermi/LAT observation class. More...
#include <GLATObservation.hpp>
Public Member Functions | |
GLATObservation (void) | |
Void constructor. More... | |
GLATObservation (const GXmlElement &xml) | |
XML constructor. More... | |
GLATObservation (const GLATObservation &obs) | |
Copy constructor. More... | |
virtual | ~GLATObservation (void) |
Destructor. More... | |
GLATObservation & | operator= (const GLATObservation &obs) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear Fermi/LAT observation. More... | |
virtual GLATObservation * | clone (void) const |
Clone Fermi/LAT observation. More... | |
virtual std::string | classname (void) const |
Return class name. More... | |
virtual void | response (const GResponse &rsp) |
Set response function. More... | |
virtual const GLATResponse * | response (void) const |
Return Fermi/LAT response function. More... | |
virtual std::string | instrument (void) const |
Return instrument name. More... | |
virtual double | ontime (void) const |
Return ontime. More... | |
virtual double | livetime (void) const |
Return livetime. More... | |
virtual double | deadc (const GTime &time=GTime()) const |
Return deadtime correction factor. More... | |
virtual void | read (const GXmlElement &xml) |
Read observation from XML element. More... | |
virtual void | write (GXmlElement &xml) const |
Write observation into XML element. More... | |
virtual std::string | print (const GChatter &chatter=NORMAL) const |
Print LAT observation information. More... | |
void | load_unbinned (const std::string &ft1name, const std::string &ft2name, const std::string <cube_name) |
Load data for unbinned analysis. More... | |
void | load_binned (const std::string &cntmap_name, const std::string &expmap_name, const std::string <cube_name) |
Load data for binned analysis. More... | |
void | response (const std::string &irfname) |
Set response function. More... | |
const GLATLtCube * | ltcube (void) const |
Return Fermi/LAT livetime cube. More... | |
Public Member Functions inherited from GObservation | |
GObservation (void) | |
Void constructor. More... | |
GObservation (const GObservation &obs) | |
Copy constructor. More... | |
virtual | ~GObservation (void) |
Destructor. More... | |
virtual GObservation & | operator= (const GObservation &obs) |
Assignment operator. More... | |
virtual GEvents * | events (void) |
Return events. More... | |
virtual const GEvents * | events (void) const |
Return events (const version) More... | |
virtual void | events (const GEvents &events) |
Set event container. More... | |
virtual double | likelihood (const GModels &models, GVector *gradients, GMatrixSparse *curvature, double *npred) const |
Compute likelihood function. More... | |
virtual double | model (const GModels &models, const GEvent &event, GVector *gradients=NULL) const |
Return model value and (optionally) gradients. More... | |
virtual GVector | model (const GModels &models, GMatrixSparse *gradients=NULL) const |
Return vector of model values and (optionally) gradients. More... | |
virtual int | nobserved (void) const |
Return total number of observed events. More... | |
virtual double | npred (const GModels &models, GVector *gradients=NULL) const |
Return total number (and optionally gradients) of predicted counts for all models. More... | |
virtual double | npred (const GModel &model) const |
Return total number of predicted counts for one model. More... | |
virtual double | model_grad (const GModel &model, const GModelPar &par, const GEvent &event) const |
Returns parameter gradient of model for a given event. More... | |
virtual GVector | model_grad (const GModel &model, const GModelPar &par) const |
Returns parameter gradients of model for all events. More... | |
virtual double | npred_grad (const GModel &model, const GModelPar &par) const |
Returns parameter gradient of Npred. More... | |
virtual void | remove_response_cache (const std::string &name) |
Response cache removal hook. More... | |
virtual const double & | grad_step_size (void) const |
Return gradient step size. More... | |
bool | has_events (void) const |
Signal if observation has events. More... | |
bool | has_gradient (const GModel &model, const GModelPar &par) const |
Check whether a model parameter has an analytical gradient. More... | |
void | name (const std::string &name) |
Set observation name. More... | |
void | id (const std::string &id) |
Set observation identifier. More... | |
void | statistic (const std::string &statistic) |
Set optimizer statistic. More... | |
const std::string & | name (void) const |
Return observation name. More... | |
const std::string & | id (void) const |
Return observation identifier. More... | |
const std::string & | statistic (void) const |
Return optimizer statistic. More... | |
void | computed_gradient (const GModel &model, const GModelPar &par) const |
Signals that an analytical gradient was computed for a model parameter. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Protected Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GLATObservation &obs) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GObservation | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GObservation &obs) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
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) More... | |
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) More... | |
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) More... | |
virtual bool | use_event_for_likelihood (const int &index) const |
Check whether bin should be used for likelihood analysis. More... | |
virtual double | npred_spec (const GModel &model, const GTime &obsTime) const |
Integrates spatially integrated Npred kernel spectrally. More... | |
Protected Attributes | |
std::string | m_ft1file |
FT1 filename. More... | |
std::string | m_ft2file |
FT2 filename. More... | |
std::string | m_ltfile |
Lifetime cube filename. More... | |
std::string | m_cntfile |
Counts map filename. More... | |
std::string | m_expfile |
Exposure map filename. More... | |
GLATResponse | m_response |
Instrument response functions. More... | |
GLATLtCube * | m_ltcube |
Pointer to livetime cube. More... | |
Protected Attributes inherited from GObservation | |
std::string | m_name |
Observation name. More... | |
std::string | m_id |
Observation identifier. More... | |
std::string | m_statistic |
Optimizer statistic. More... | |
GEvents * | m_events |
Pointer to event container. More... | |
double | m_grad_step_size |
Gradient step size. More... | |
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(), 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(), GLATEventCube::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 GLATEventList::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(), GLATResponse::print(), GLATLtCube::print(), GEvents::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().
|
inlinevirtual |
Return Fermi/LAT response function.
Implements GObservation.
Definition at line 120 of file GLATObservation.hpp.
References m_response.
Referenced by read().
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.
|
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(), and write().