44 #define G_FILL_CUBE "GCTACubeExposure::fill_cube(GCTAObservation&, GLog*)"
163 const std::string& coords,
252 if (exposure < 0.0) {
337 for (
int i = 0; i < obs.
size(); ++i) {
347 *log << obs[i]->instrument();
348 *log <<
" observation ";
349 *log <<
"\"" << obs[i]->name() <<
"\"";
350 *log <<
" (id=" << obs[i]->id() <<
")" << std::endl;
358 *log <<
"Skipping binned ";
360 *log <<
" observation ";
361 *log <<
"\"" << cta->
name() <<
"\"";
362 *log <<
" (id=" << cta->
id() <<
")" << std::endl;
428 if (fits.
size() > 0) {
454 #pragma omp critical(GCTACubeExposure_load)
458 GFits fits(filename);
487 #pragma omp critical(GCTACubeExposure_save)
497 fits.
saveto(filename, clobber);
529 result.append(
"=== GCTACubeExposure ===");
657 std::string msg =
"No RoI information found in "+obs.
instrument()+
658 " observation \""+obs.
name()+
"\". Run ctselect "
659 "to specify an RoI for this observation.";
670 std::string msg =
"No valid instrument response function found in "+
672 "\". Please specify the instrument response "
673 "function for this observation.";
680 *log <<
"Skipping unbinned ";
682 *log <<
" observation ";
683 *log <<
"\"" << obs.
name() <<
"\"";
684 *log <<
" (id=" << obs.
id() <<
") due to zero livetime";
692 *log <<
"Skipping unbinned ";
694 *log <<
" observation ";
695 *log <<
"\"" << obs.
name() <<
"\"";
696 *log <<
" (id=" << obs.
id() <<
") since it does not overlap ";
697 *log <<
"with the exposure cube.";
707 *log <<
"Including ";
709 *log <<
" observation \"" << obs.
name();
710 *log <<
"\" (id=" << obs.
id() <<
")";
711 *log <<
" in exposure cube computation." << std::endl;
715 for (
int pixel = 0; pixel <
m_cube.
npix(); ++pixel) {
727 double theta = pnt.
dist(dir);
736 m_cube(pixel, iebin) += rsp->aeff(theta, 0.0, 0.0, 0.0, logE) *
803 for (
int i = 0; i < bins; ++i) {
848 std::string date_obs = utc_obs.substr(0, 10);
849 std::string time_obs = utc_obs.substr(11, 8);
850 std::string date_end = utc_end.substr(0, 10);
851 std::string time_end = utc_end.substr(11, 8);
854 hdu.
card(
"CREATOR",
"GammaLib",
"Program which created the file");
855 hdu.
card(
"TELESCOP",
"unknown",
"Telescope");
856 hdu.
card(
"OBS_ID",
"unknown",
"Observation identifier");
857 hdu.
card(
"DATE-OBS", date_obs,
"Observation start date");
858 hdu.
card(
"TIME-OBS", time_obs,
"Observation start time");
859 hdu.
card(
"DATE-END", date_end,
"Observation end date");
860 hdu.
card(
"TIME-END", time_end,
"Observation end time");
863 hdu.
card(
"TSTART", tstart,
"[s] Mission time of start of observation");
864 hdu.
card(
"TSTOP", tstop,
"[s] Mission time of end of observation");
866 hdu.
card(
"TELAPSE", telapse,
"[s] Mission elapsed time");
867 hdu.
card(
"ONTIME", ontime,
"[s] Total good time including deadtime");
869 hdu.
card(
"DEADC", deadc,
"Deadtime correction factor");
870 hdu.
card(
"TIMEDEL", 1.0,
"Time resolution");
873 hdu.
card(
"BUNIT",
"cm**2 s",
"Unit of exposure cube");
std::string print(const GChatter &chatter=NORMAL) const
Print energy container information.
void clear(void)
Clear energy container.
Abstract FITS image base class.
double operator()(const GSkyDir &dir, const GEnergy &energy) const
Return exposure (in units of cm**2 s)
void read(const GFitsTable &table)
Read energies from FITS table.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
double m_livetime
Livetime (sec)
bool has_card(const int &cardno) const
Check existence of header card.
void write(GFits &file, const std::string &extname=gammalib::extname_energies) const
Write energies into FITS object.
void fill(const GObservations &obs, GLog *log=NULL)
Fill exposure cube from observation container.
void write(GFits &file) const
Write CTA exposure cube into FITS file.
Definition of GammaLib CTA typemaps.
void ebounds(const GEbounds &ebounds)
Set energy boundaries.
Abstract FITS extension base class.
bool overlaps(const GSkyRegion ®ion) const
Checks whether a region overlaps with this map.
GEbounds ebounds(void) const
Get energy boundaries.
CTA instrument response function class definition.
void clear(void)
Clear instance.
void read(const GFits &fits)
Read exposure cube from FITS object.
const double & radius(void) const
Returns radius of region of interest in degrees.
const double & wgt_left(void) const
Returns left node weight.
virtual void response(const GResponse &rsp)
Set response function.
void clear(void)
Clear node array.
void counts(const GSkyMap &counts)
Set event cube counts from sky map.
double log10TeV(void) const
Return log10 of energy in TeV.
void write_attributes(GFitsHDU &hdu) const
Write attributes to exposure extension.
Interface for the CTA region of interest class.
GCTACubeExposure & operator=(const GCTACubeExposure &exp)
Assignment operator.
const std::string extname_gti
Interface for the circular sky region class.
void set_value(const double &value) const
Set indices and weighting factors for interpolation.
void pointing(const GCTAPointing &pointing)
Set CTA pointing.
void init_members(void)
Initialise class members.
std::string print(const GChatter &chatter=NORMAL) const
Print Good Time Intervals.
void read(const GFitsHDU &hdu)
Read skymap from FITS HDU.
void dir(const GSkyDir &dir)
Set sky direction.
GCTACubeExposure * clone(void) const
Clone exposure cube.
void update(const double &logE) const
Update 1D cache.
std::string print(const GChatter &chatter=NORMAL) const
Print exposure cube information.
void fill_cube(const GCTAObservation &obs, GLog *log=NULL)
Fill exposure cube for one observation.
int size(void) const
Return number of Good Time Intervals.
void id(const std::string &id)
Set observation identifier.
void load(const GFilename &filename)
Load exposure cube from FITS file.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
std::string print(const GChatter &chatter=NORMAL) const
Print sky map.
double real(const std::string &keyname) const
Return card value as double precision.
void reference(const GTimeReference &ref)
Set time reference for Good Time Intervals.
Information logger interface definition.
CTA event bin container class.
virtual double livetime(void) const
Return livetime.
GCTACubeExposure(void)
Void constructor.
void clear(void)
Clear Good Time Intervals.
const double & wgt_right(void) const
Returns right node weight.
Energy boundaries container class.
const int & nmaps(void) const
Returns number of maps.
GSkyDir inx2dir(const int &index) const
Returns sky direction of pixel.
GCTARoi roi(void) const
Get Region of Interest.
GFitsHDU * write(GFits &file, const std::string &extname="") const
Write sky map into FITS file.
GGti gti(void) const
Get Good Time Intervals.
const GCTAInstDir & centre(void) const
Returns region of interest centre.
const GEnergies & energies(void) const
Return energies.
int size(void) const
Return number of energies in container.
virtual std::string instrument(void) const
Return instrument name.
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
const GFilename & filename(void) const
Return exposure cube filename.
GSkyMap m_cube
Average Exposure cube.
double m_wgt_right
Weight of right node.
GFilename m_filename
Filename.
Abstract interface for FITS table.
void read_attributes(const GFitsHDU &hdu)
Read exposure attributes.
double deadc(void) const
Return deadtime correction.
const int & inx_left(void) const
Returns left node index.
void clear(void)
Clear instance.
int size(void) const
Return number of observations in container.
const GTime & tstop(void) const
Returns latest stop time in Good Time Intervals.
CTA response abstract base class definition.
const GTime & tstart(void) const
Returns earliest start time in Good Time Intervals.
CTA observation class interface definition.
Observation container class.
void copy_members(const GCTACubeExposure &exp)
Copy class members.
CTA instrument response function class.
const int & inx_right(void) const
Returns right node index.
const std::string extname_energies
void set(const GEbounds &ebounds)
Set energies from energy boundaries.
void name(const std::string &name)
Set observation name.
void free_members(void)
Delete class members.
void save(const GFilename &filename, const bool &clobber=false) const
Save exposure cube into FITS file.
GFitsImage * image(const int &extno)
Get pointer to image HDU.
Information logger class definition.
void clear(void)
Clear file name.
void set(const GCTAObservation &obs)
Set exposure cube for one CTA observation.
void read(const GFitsTable &table)
Read Good Time Intervals and time reference from FITS table.
int size(void) const
Return number of HDUs in FITS file.
const double & ontime(void) const
Return ontime.
CTA event bin container class interface definition.
int m_inx_right
Index of right node.
std::string eventtype(void) const
Return event type string.
bool is_valid(void) const
Checks if RoI is valid.
void set_eng_axis(void)
Set nodes for a logarithmic (base 10) energy axis.
double dist(const GSkyDir &dir) const
Compute angular distance between sky directions in radians.
Implements a time reference.
int m_inx_left
Index of left node.
virtual ~GCTACubeExposure(void)
Destructor.
GNodeArray m_elogmeans
Mean energy for the Exposure cube.
CTA cube analysis exposure class definition.
#define G_CTA_MJDREF
Reference of CTA time frame.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void append(const double &node)
Append one node to array.
const double & telapse(void) const
Returns elapsed time.
const int & npix(void) const
Returns number of pixels.
bool is_empty(void) const
Signal if there are no Good Time Intervals.
GFitsHeaderCard & card(const int &cardno)
Return header card.
Observations container class interface definition.
void write(GFits &fits, const std::string &extname=gammalib::extname_gti) const
Write Good Time Intervals and time reference into FITS object.
void close(void)
Close FITS file.
std::string utc(const int &precision=0) const
Return time as string in UTC time system.
Circular sky region class interface definition.
void extend(const GGti >i)
Append Good Time Intervals.
const double & ontime(void) const
Returns ontime.
GEnergies m_energies
Energy values for the Exposure cube.
double convert(const GTimeReference &ref) const
Return time in specified reference.
GGti m_gti
Good time interval for the Exposure cube.
Mathematical function definitions.
double m_wgt_left
Weight of left node.
Class that handles energies in a unit independent way.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.