39#define G_NAXIS "GLATEventCube::naxis(int)"
40#define G_DIFFNAME "GLATEventCube::diffname(int&)"
41#define G_DIFFRSP "GLATEventCube::diffrsp(int&)"
42#define G_READ_SRCMAP "GLATEventCube::read_srcmap(GFitsImage&)"
43#define G_SET_DIRECTIONS "GLATEventCube::set_directions()"
44#define G_SET_ENERGIES "GLATEventCube::set_energies()"
45#define G_SET_TIMES "GLATEventCube::set_times()"
46#define G_SET_BIN "GLATEventCube::set_bin(int&)"
51#define G_MISSING_WCS_KLUDGE
281 #if defined(G_RANGE_CHECK)
282 if (axis < 0 || axis >=
dim()) {
315 GFits fits(filename);
337 const bool& clobber)
const
346 fits.
saveto(filename, clobber);
384 for (
int i = 1; i < fits.
size(); ++i) {
394 #if defined(G_MISSING_WCS_KLUDGE)
395 std::string keys[] = {
"CTYPE1",
"CTYPE2",
"CTYPE3",
396 "CRPIX1",
"CRPIX2",
"CRPIX3",
397 "CRVAL1",
"CRVAL2",
"CRVAL3",
398 "CDELT1",
"CDELT2",
"CDELT3",
399 "CUNIT1",
"CUNIT2",
"CUNIT3",
401 for (
int i = 0; i < 16; ++i) {
402 if (!hdu_srcmap.
has_card(keys[i])) {
403 const_cast<GFitsImage&
>(hdu_srcmap).card(hdu_cntmap.
card(keys[i]));
437 for (
int i = 0; i <
m_srcmap.size(); ++i) {
460 if (
size() > 0 && pixels != NULL) {
461 for (
int i = 0; i <
size(); ++i) {
502 result.append(
"=== GLATEventCube ===");
524 result.append(
"not defined");
533 result.append(
"not defined");
538 if (reduced_chatter >
SILENT) {
548 for (
int i = 0; i <
m_srcmap.size(); ++i) {
551 result.append(
" x ");
553 result.append(
" x ");
580 #if defined(G_RANGE_CHECK)
581 if (index < 0 || index >=
ndiffrsp()) {
606 #if defined(G_RANGE_CHECK)
607 if (index < 0 || index >=
ndiffrsp()) {
642 for (
int ix = 0; ix <
nx(); ++ix) {
645 if (distance < radius) {
652 for (
int ix = 0; ix <
nx(); ++ix) {
655 if (distance < radius) {
662 for (
int iy = 0; iy <
ny(); ++iy) {
665 if (distance < radius) {
672 for (
int iy = 0; iy <
ny(); ++iy) {
675 if (distance < radius) {
736 for (
int i = 0; i < cube.
m_srcmap.size(); ++i) {
752 for (
int i = 0; i <
m_srcmap.size(); ++i) {
809 std::string msg =
"Specified source map projection in HDU \""+
810 hdu.
extname()+
"\" is incompatible with map projection "
811 "of the event cube. Please specify a compatible "
822 hdu.
extname()+
"\" is not compatible with number of "
825 "Please specify a source map of compatible size.";
832 " in source map in HDU \""+hdu.
extname()+
"\" is not "
833 "compatible with number of energy bin boundaries ("+
835 "Please specify a source map of compatible size.";
897 hdu_local->
card(
"MJDREFI", 51910,
898 "Integer part of MJD reference");
899 hdu_local->
card(
"MJDREFF", 0.00074287037037037,
900 "Fractional part of MJD reference");
929 std::string msg =
"LAT event cube contains no sky pixels. Please "
930 "provide a valid LAT event cube.";
943 for (
int iy = 0; iy <
ny(); ++iy) {
944 for (
int ix = 0; ix <
nx(); ++ix) {
970 std::string msg =
"LAT event cube contains no energy bins. Please "
971 "provide a valid LAT event cube.";
985 for (
int i = 0; i <
ebins(); ++i) {
1015 std::string msg =
"No Good Time Intervals have been found in event "
1016 "cube. Every LAT event cube needs a definition "
1017 "of the Good Time Intervals.";
1052 #if defined(G_RANGE_CHECK)
1053 if (index < 0 || index >=
size()) {
1061 ") is incompatible with size of energies ("+
1064 "). Please provide an correctly initialised event "
1072 ") is incompatible with size of sky directions ("+
1075 "). Please provide an correctly initialised event "
Exception handler interface definition.
Filename class interface definition.
Abstract FITS image base class definition.
FITS table abstract base class interface definition.
Fermi/LAT event cube class definition.
GVector log10(const GVector &vector)
Computes base10 logarithm of vector elements.
const GEnergy & emax(void) const
Return maximum energy of all intervals.
void read(const GFitsTable &table)
Read energy boundaries from FITS table.
GEnergy elogmean(const int &index) const
Returns logarithmic mean energy for a given energy interval.
const GEnergy & emin(void) const
Return minimum energy of all intervals.
void write(GFits &file, const std::string &extname=gammalib::extname_ebounds, const std::string &unit="keV") const
Write energy boundaries into FITS object.
Abstract event bin container class.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
virtual GEventCube & operator=(const GEventCube &cube)
Assignment operator.
void free_members(void)
Delete class members.
GGti m_gti
Good time intervals covered by events.
const GTime & tstart(void) const
Return start time.
GEbounds m_ebounds
Energy boundaries covered by events.
const GGti & gti(void) const
Return Good Time Intervals.
void init_members(void)
Initialise class members.
const GTime & tstop(void) const
Return stop time.
const GEbounds & ebounds(void) const
Return energy boundaries.
const GEnergy & emax(void) const
Return maximum energy.
const GEnergy & emin(void) const
Return minimum energy.
virtual HDUType exttype(void) const =0
const GFitsHeader & header(void) const
Return extension header.
bool has_card(const int &cardno) const
Check existence of header card.
const std::string & extname(void) const
Return extension name.
std::string string(const std::string &keyname) const
Return card value as string.
GFitsHeaderCard & card(const int &cardno)
Return header card.
Abstract FITS image base class.
Abstract interface for FITS table.
virtual GFitsTable * clone(void) const =0
Clones object.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
int size(void) const
Return number of HDUs in FITS file.
GFitsImage * image(const int &extno)
Get pointer to image HDU.
void close(void)
Close FITS file.
GFitsHDU * at(const int &extno)
Get pointer to HDU.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
void write(GFits &fits, const std::string &extname=gammalib::extname_gti) const
Write Good Time Intervals and time reference into FITS object.
const GTime & tstop(void) const
Returns latest stop time in Good Time Intervals.
void read(const GFitsTable &table)
Read Good Time Intervals and time reference from FITS table.
int size(void) const
Return number of Good Time Intervals.
const double & ontime(void) const
Returns ontime.
const GTime & tstart(void) const
Returns earliest start time in Good Time Intervals.
Fermi/LAT event bin class.
GEnergy * m_ewidth
Pointer to energy width of bin.
int m_index
Actual skymap index.
GLATEventCube * m_cube
Event cube back pointer.
double * m_solidangle
Pointer to solid angle of pixel (sr)
int m_ipix
Actual spatial index.
double * m_ontime
Pointer to ontime of bin (seconds)
int m_ieng
Actual energy index.
double * m_counts
Pointer to number of counts.
virtual void clear(void)
Clear event bin.
GEnergy * m_energy
Pointer to bin energy.
GLATInstDir * m_dir
Pointer to bin direction.
GTime * m_time
Pointer to bin time.
Fermi/LAT event cube class.
GLATEventBin m_bin
Actual energy bin.
virtual GLATEventCube * clone(void) const
Clone instance.
double maxrad(const GSkyDir &dir) const
Computes the maximum radius (in degrees) around a given source direction that fits spatially into the...
GLATEventCube(void)
Void constructor.
virtual void clear(void)
Clear instance.
std::vector< GSkyMap * > m_srcmap
Pointers to source maps.
virtual ~GLATEventCube(void)
Destructor.
virtual void set_energies(void)
Set log mean energies and energy widths of event cube.
void copy_members(const GLATEventCube &cube)
Copy class members.
void set_directions(void)
Set sky directions and solid angles of events cube.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event cube information.
virtual int number(void) const
Return number of events in cube.
const GSkyMap & map(void) const
Return event cube sky map.
virtual int dim(void) const
Return dimension of event cube.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save LAT event cube into FITS file.
void read_gti(const GFitsTable &hdu)
Read GTIs from HDU.
virtual void load(const GFilename &filename)
Load LAT event cube from FITS file.
int npix(void) const
Return number of pixels in event cube sky map.
GTime m_time
Event cube mean time.
int ndiffrsp(void) const
Return number of diffuse model components.
virtual void set_times(void)
Set mean event time and ontime of event cube.
virtual int size(void) const
Return number of bins in event cube.
virtual int naxis(const int &axis) const
Return number of bins in axis.
void free_members(void)
Delete class members.
std::vector< double > m_solidangle
Array of solid angles (sr)
std::vector< GEnergy > m_energies
Array of log mean energies.
int ny(void) const
Return number of bins in Y direction.
void read_cntmap(const GFitsImage &hdu)
Read Fermi/LAT counts map from HDU.
int nx(void) const
Return number of bins in X direction.
virtual void read(const GFits &file)
Read LAT event cube from FITS file.
void read_srcmap(const GFitsImage &hdu)
Read LAT source map from HDU.
virtual void write(GFits &file) const
Write LAT event cube into FITS file.
std::vector< GLATInstDir > m_dirs
Array of event directions.
GNodeArray m_enodes
Energy nodes.
void read_ebds(const GFitsTable &hdu)
Read energy boundaries from HDU.
GSkyMap * diffrsp(const int &index) const
Return diffuse response map.
int ebins(void) const
Return number of energy bins in event cube.
GSkyMap m_map
Counts map stored as sky map.
std::string diffname(const int &index) const
Return name of diffuse model.
double m_ontime
Event cube ontime (sec)
std::vector< std::string > m_srcmap_names
Source map names.
std::vector< GEnergy > m_ewidth
Array of energy bin widths.
virtual GLATEventBin * operator[](const int &index)
Event bin access operator.
void set_bin(const int &index)
Set event bin.
virtual GLATEventCube & operator=(const GLATEventCube &cube)
Assignment operator.
void init_members(void)
Initialise class members.
Fermi/LAT instrument direction class.
void clear(void)
Clear node array.
void append(const double &node)
Append one node to array.
double dist_deg(const GSkyDir &dir) const
Compute angular distance between sky directions in degrees.
double solidangle(const int &index) const
Returns solid angle of pixel.
const int & nmaps(void) const
Returns number of maps.
void clear(void)
Clear instance.
const int & nx(void) const
Returns number of pixels in x coordinate.
void read(const GFitsHDU &hdu)
Read skymap from FITS HDU.
const int & npix(void) const
Returns number of pixels.
const int & ny(void) const
Returns number of pixels in y coordinate.
const GSkyProjection * projection(void) const
Returns pointer to sky projection.
GFitsHDU * write(GFits &file, const std::string &extname="") const
Write sky map into FITS file.
GSkyDir pix2dir(const GSkyPixel &pixel) const
Returns sky direction of pixel.
bool contains(const GSkyDir &dir) const
Checks if sky direction falls in map.
const double * pixels(void) const
Returns pointer to pixel data.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
void clear(void)
Clear time.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
const std::string extname_ebounds
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
const std::string extname_gti