47 #define G_RESPONSE "GLATObservation::response(GResponse&)"
48 #define G_READ "GLATObservation::read(GXmlElement&)"
49 #define G_WRITE "GLATObservation::write(GXmlElement&)"
217 if (latrsp == NULL) {
218 std::string cls = std::string(
typeid(&rsp).
name());
219 std::string msg =
"Invalid response type \""+cls+
"\" specified. "
220 "Please specify a \"GLATResponse\" instance as "
298 std::string ft1file =
"";
299 std::string ft2file =
"";
300 std::string ltfile =
"";
301 std::string cntfile =
"";
302 std::string expfile =
"";
303 std::string irfname =
"";
306 int npars = xml.
elements(
"parameter");
312 int npar1[] = {0, 0, 0, 0};
313 int npar2[] = {0, 0, 0, 0};
314 for (
int i = 0; i < npars; ++i) {
324 else if (par->
attribute(
"name") ==
"FT2") {
330 else if (par->
attribute(
"name") ==
"CountsMap") {
334 else if (par->
attribute(
"name") ==
"ExposureMap") {
340 else if (par->
attribute(
"name") ==
"LiveTimeCube") {
345 else if (par->
attribute(
"name") ==
"IRF") {
354 bool unbin_ok = (npar1[0] == 1 && npar1[1] == 1 && npar1[2] == 1 && npar1[3] == 1);
355 bool bin_ok = (npar2[0] == 1 && npar2[1] == 1 && npar2[2] == 1 && npar2[3] == 1);
356 if (!bin_ok && !unbin_ok) {
357 std::string msg =
"Require either \"FT1\", \"FT2\", \"LiveTimeCube\", "
358 "and \"IRF\" or \"CountsMap\", \"ExposureMap\", "
359 "\"LiveTimeCube\", and \"IRF\" parameters. Please "
360 "verify the XML format.";
434 if (list == NULL && cube == NULL) {
436 std::string msg =
"No events associated with LAT observation. "
437 "Please allocate events before calling the "
442 std::string cls = std::string(
typeid(&
m_events).
name());
443 std::string msg =
"Invalid event type \""+cls+
"\" encountered. A "
444 "LAT observation can only contain a LAT event "
445 "list or cube. Please set up LAT observation "
452 bool is_list = (list != NULL);
474 int npar[] = {0, 0, 0, 0};
475 for (
int i = 0; i < 4; ++i) {
487 else if (par->
attribute(
"name") ==
"CountsMap") {
493 else if (par->
attribute(
"name") ==
"FT2") {
499 else if (par->
attribute(
"name") ==
"ExposureMap") {
505 else if (par->
attribute(
"name") ==
"LiveTimeCube") {
511 else if (par->
attribute(
"name") ==
"IRF") {
519 if (npar[0] != 1 || npar[1] != 1 || npar[2] != 1 || npar[3] != 1) {
520 std::string msg =
"Require either \"FT1\", \"FT2\", \"LiveTimeCube\", "
521 "and \"IRF\" or \"CountsMap\", \"ExposureMap\", "
522 "\"LiveTimeCube\", and \"IRF\" parameters. Please "
523 "verify the XML format.";
547 result.append(
"=== GLATObservation ===");
561 if (reduced_chatter >
SILENT) {
572 result.append(
"undefined");
600 const std::string& ft2name,
601 const std::string& ltcube_name)
628 if (ltcube_name.length() > 0) {
654 const std::string& expmap_name,
655 const std::string& ltcube_name)
671 events->
load(cntmap_name);
674 if (ltcube_name.length() > 0) {
std::string m_ltfile
Lifetime cube filename.
void init_members(void)
Initialise class members.
const std::string & statistic(void) const
Return optimizer statistic.
Fermi/LAT observation class.
const GLATObservation g_obs_lat_seed
Fermi/LAT observation class definition.
std::string m_ft2file
FT2 filename.
Energy value class definition.
virtual void read(const GXmlElement &xml)
Read observation from XML element.
void load(const GFilename &filename)
Load livetime cube from FITS file.
void copy_members(const GLATObservation &obs)
Copy class members.
GEvents * m_events
Pointer to event container.
GLATObservation(void)
Void constructor.
virtual void load(const GFilename &filename)
Load LAT event cube from FITS file.
Fermi/LAT Response class.
void load(const std::string &rspname)
Load Fermi LAT response from calibration database.
void free_members(void)
Delete class members.
virtual int elements(void) const
Return number of GXMLElement children of node.
virtual GLATObservation * clone(void) const
Clone Fermi/LAT observation.
FITS file class interface definition.
Fermi/LAT region of interest class definition.
GLATLtCube * clone(void) const
Clone livetime cube.
std::string print(const GChatter &chatter=NORMAL) const
Print livetime cube information.
const std::string & rspname(void) const
Return response name.
GFilename xml_file_reduce(const GXmlElement &xml, const std::string &filename)
Reduce file name provided for writing as XML attribute.
GLATObservation & operator=(const GLATObservation &obs)
Assignment operator.
std::string m_ft1file
FT1 filename.
virtual void clear(void)
Clear response.
virtual ~GLATObservation(void)
Destructor.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print LAT observation information.
void free_members(void)
Delete class members.
virtual void clear(void)
Clear Fermi/LAT observation.
virtual double livetime(void) const
Return livetime.
const GXmlAttribute * attribute(const int &index) const
Return attribute.
GLATLtCube * m_ltcube
Pointer to livetime cube.
virtual double ontime(void) const
Return ontime.
void load_binned(const std::string &cntmap_name, const std::string &expmap_name, const std::string <cube_name)
Load data for binned analysis.
Interface definition for the observation registry class.
const std::string & name(void) const
Return observation name.
Observation registry class definition.
virtual void write(GXmlElement &xml) const
Write observation into XML element.
Fermi/LAT event cube class definition.
Fermi/LAT event cube class.
void init_members(void)
Initialise class members.
Abstract observation base class.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Fermi-LAT response information.
void xml_check_parnum(const std::string &origin, const GXmlElement &xml, const int &number)
Checks number of parameters.
Fermi/LAT event list class.
std::string m_expfile
Exposure map filename.
virtual GXmlElement * element(const int &index)
Return pointer to GXMLElement child.
Fermi/LAT event list class definition.
virtual const GLATResponse * response(void) const
Return Fermi/LAT response function.
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
virtual GObservation & operator=(const GObservation &obs)
Assignment operator.
virtual GEvents * events(void)
Return events.
Exception handler interface definition.
virtual void read(const GFits &file)
Read LAT events from FITS file.
std::string m_cntfile
Counts map filename.
virtual std::string instrument(void) const
Return instrument name.
virtual GXmlNode * append(const GXmlNode &node)
Append XML child node.
Abstract instrument response base class.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
GLATResponse m_response
Instrument response functions.
void close(void)
Close FITS file.
Interface for the Fermi LAT livetime cube.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
void load_unbinned(const std::string &ft1name, const std::string &ft2name, const std::string <cube_name)
Load data for unbinned analysis.
GFilename xml_file_expand(const GXmlElement &xml, const std::string &filename)
Expand file name provided as XML attribute for loading.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.