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)
487 #pragma omp critical(GCTACubeExposure_save)
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");
CTA cube analysis exposure class definition.
CTA event bin container class interface definition.
CTA observation class interface definition.
CTA instrument response function class definition.
CTA response abstract base class definition.
Definition of GammaLib CTA typemaps.
#define G_CTA_MJDREF
Reference of CTA time frame.
Information logger class definition.
Mathematical function definitions.
Observations container class interface definition.
Circular sky region class interface definition.
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
void set(const GCTAObservation &obs)
Set exposure cube for one CTA observation.
void read(const GFits &fits)
Read exposure cube from FITS object.
const GEnergies & energies(void) const
Return energies.
void free_members(void)
Delete class members.
GNodeArray m_elogmeans
Mean energy for the Exposure cube.
GSkyMap m_cube
Average Exposure cube.
virtual ~GCTACubeExposure(void)
Destructor.
int m_inx_right
Index of right node.
GCTACubeExposure * clone(void) const
Clone exposure cube.
GCTACubeExposure(void)
Void constructor.
GCTACubeExposure & operator=(const GCTACubeExposure &exp)
Assignment operator.
GGti m_gti
Good time interval for the Exposure cube.
int m_inx_left
Index of left node.
const double & ontime(void) const
Return ontime.
double m_wgt_right
Weight of right node.
GEnergies m_energies
Energy values for the Exposure cube.
void copy_members(const GCTACubeExposure &exp)
Copy class members.
void fill_cube(const GCTAObservation &obs, GLog *log=NULL)
Fill exposure cube for one observation.
void init_members(void)
Initialise class members.
std::string print(const GChatter &chatter=NORMAL) const
Print exposure cube information.
void write(GFits &file) const
Write CTA exposure cube into FITS file.
void save(const GFilename &filename, const bool &clobber=false) const
Save exposure cube into FITS file.
void update(const double &logE) const
Update 1D cache.
void set_eng_axis(void)
Set nodes for a logarithmic (base 10) energy axis.
GFilename m_filename
Filename.
const GSkyMap & cube(void) const
Return exposure cube.
void clear(void)
Clear instance.
void fill(const GObservations &obs, GLog *log=NULL)
Fill exposure cube from observation container.
void load(const GFilename &filename)
Load exposure cube from FITS file.
const GFilename & filename(void) const
Return exposure cube filename.
void read_attributes(const GFitsHDU &hdu)
Read exposure attributes.
double m_wgt_left
Weight of left node.
double deadc(void) const
Return deadtime correction.
double operator()(const GSkyDir &dir, const GEnergy &energy) const
Return exposure (in units of cm**2 s)
double m_livetime
Livetime (sec)
void write_attributes(GFitsHDU &hdu) const
Write attributes to exposure extension.
CTA event bin container class.
void dir(const GSkyDir &dir)
Set sky direction.
void pointing(const GCTAPointing &pointing)
Set CTA pointing.
GGti gti(void) const
Get Good Time Intervals.
virtual double livetime(void) const
Return livetime.
std::string eventtype(void) const
Return event type string.
virtual std::string instrument(void) const
Return instrument name.
GCTARoi roi(void) const
Get Region of Interest.
GEbounds ebounds(void) const
Get energy boundaries.
virtual void response(const GResponse &rsp)
Set response function.
CTA instrument response function class.
const GCTAAeff * aeff(void) const
Return pointer to effective area response.
Interface for the CTA region of interest class.
const double & radius(void) const
Returns radius of region of interest in degrees.
bool is_valid(void) const
Checks if RoI is valid.
const GCTAInstDir & centre(void) const
Returns region of interest centre.
Energy boundaries container class.
std::string print(const GChatter &chatter=NORMAL) const
Print energy container information.
void read(const GFitsTable &table)
Read energies from FITS table.
void clear(void)
Clear energy container.
int size(void) const
Return number of energies in container.
void set(const GEbounds &ebounds)
Set energies from energy boundaries.
void write(GFits &file, const std::string &extname=gammalib::extname_energies) const
Write energies into FITS object.
Class that handles energies in a unit independent way.
double log10TeV(void) const
Return log10 of energy in TeV.
void clear(void)
Clear file name.
Abstract FITS extension base class.
bool has_card(const int &cardno) const
Check existence of header card.
double real(const std::string &keyname) const
Return card value as double precision.
GFitsHeaderCard & card(const int &cardno)
Return header card.
Abstract FITS image base class.
Abstract interface for FITS table.
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.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
std::string print(const GChatter &chatter=NORMAL) const
Print Good Time Intervals.
const double & telapse(void) const
Returns elapsed time.
void reference(const GTimeReference &ref)
Set time reference for Good Time Intervals.
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 extend(const GGti >i)
Append Good Time Intervals.
void read(const GFitsTable &table)
Read Good Time Intervals and time reference from FITS table.
bool is_empty(void) const
Signal if there are no Good Time Intervals.
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.
void clear(void)
Clear Good Time Intervals.
Information logger interface definition.
void set_value(const double &value) const
Set indices and weighting factors for interpolation.
const int & inx_right(void) const
Returns right node index.
const int & inx_left(void) const
Returns left node index.
const double & wgt_right(void) const
Returns right node weight.
const double & wgt_left(void) const
Returns left node weight.
void clear(void)
Clear node array.
void append(const double &node)
Append one node to array.
void name(const std::string &name)
Set observation name.
void id(const std::string &id)
Set observation identifier.
Observation container class.
int size(void) const
Return number of observations in container.
double dist(const GSkyDir &dir) const
Compute angular distance between sky directions in radians.
const int & nmaps(void) const
Returns number of maps.
void clear(void)
Clear instance.
GSkyDir inx2dir(const int &index) const
Returns sky direction of pixel.
void read(const GFitsHDU &hdu)
Read skymap from FITS HDU.
const int & npix(void) const
Returns number of pixels.
GNdarray counts(void) const
Returns array with total number of counts for count maps.
GFitsHDU * write(GFits &file, const std::string &extname="") const
Write sky map into FITS file.
bool overlaps(const GSkyRegion ®ion) const
Checks whether a region overlaps with this map.
std::string print(const GChatter &chatter=NORMAL) const
Print sky map.
Interface for the circular sky region class.
Implements a time reference.
double convert(const GTimeReference &ref) const
Return time in specified reference.
std::string utc(const int &precision=0) const
Return time as string in UTC time system.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
const std::string extname_gti
const std::string extname_energies