44#define G_READ "GCTAPsfTable::read(GFitsTable&)"
45#define G_CONTAINMENT_RADIUS "GCTAPsfTable::containment_radius(double&,"\
46 " double&, double&, double&, double&, double&, bool&)"
196 const double& zenith,
197 const double& azimuth,
198 const bool& etrue)
const
304 std::string msg =
"Expected three-dimensional point spread function "
305 "response table but found "+
307 " dimensions. Please specify a three-dimensional "
308 "point spread function.";
373 if (extname.empty()) {
430 table.extname(extname);
461 const double& zenith,
462 const double& azimuth,
463 const bool& etrue)
const
478 delta = std::acos(1.0 - ran.
uniform() * cosrad);
481 double value = this->
operator()(delta, logE, theta, phi, zenith,
488 if (uniform <= value) {
516 const double& zenith,
517 const double& azimuth,
518 const bool& etrue)
const
547 const double& zenith,
548 const double& azimuth,
549 const bool& etrue)
const
552 if (fraction <= 0.0 || fraction >= 1.0) {
553 std::string message =
"Containment fraction "+
555 "0.0 and 1.0, not inclusive.";
568 for (
int idelta = 0; idelta < ndelta; ++idelta) {
579 sum += this->
operator()(delta, logE, theta, phi, zenith, azimuth, etrue) *
583 if (
sum >= fraction) {
609 result.append(
"=== GCTAPsfTable ===");
744 for (
int ieng = 0; ieng < neng; ++ieng) {
745 for (
int itheta = 0; itheta < ntheta; ++itheta) {
751 int inx =
element(ieng, itheta, 0);
755 for (
int idelta = 0; idelta < ndelta; ++idelta, inx += inx_inc) {
776 int inx =
element(ieng, itheta, 0);
779 for (
int idelta = 0; idelta < ndelta; ++idelta, inx += inx_inc) {
#define G_CONTAINMENT_RADIUS
CTA point spread function table class definition.
Definition of support function used by CTA classes.
Exception handler interface definition.
Filename class interface definition.
FITS binary table class definition.
FITS table abstract base class interface definition.
FITS file class interface definition.
Mathematical function definitions.
Random number generator class definition.
double sum(const GVector &vector)
Computes vector sum.
CTA point spread function table class.
GCTAPsfTable * clone(void) const
Clone point spread functions.
int m_inx_rpsf
PSF histogram.
int m_inx_theta
Theta index.
void clear(void)
Clear point spread function.
void write(GFitsBinTable &table) const
Write point spread function into FITS table.
double delta_max(const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
Return maximum size of PSF (radians)
void precompute(void)
Performs precomputations for point spread function.
GCTAPsfTable & operator=(const GCTAPsfTable &psf)
Assignment operator.
GFilename m_filename
Name of Aeff response file.
GCTAResponseTable m_psf
PSF response table.
GFilename filename(void) const
Return filename.
void free_members(void)
Delete class members.
void copy_members(const GCTAPsfTable &psf)
Copy class members.
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function information.
int element(const int &ieng, const int &itheta, const int &idelta)
Return element index.
virtual ~GCTAPsfTable(void)
Destructor.
double operator()(const double &delta, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
Return point spread function (in units of sr^-1)
void read(const GFitsTable &table)
Read point spread function from FITS table.
GCTAPsfTable(void)
Void constructor.
const GCTAResponseTable & table(void) const
Return response table.
int m_inx_energy
Energy index.
double mc(GRan &ran, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
Simulate PSF offset (radians)
void save(const GFilename &filename, const bool &clobber=false) const
Save point spread function table into FITS file.
double m_psf_max
Maximum PSF value.
void init_members(void)
Initialise class members.
int m_inx_delta
Delta index.
double containment_radius(const double &fraction, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
Return the radius that contains a fraction of the events (radians)
void load(const GFilename &filename)
Load point spread function from FITS file.
double m_delta_max
Maximum delta angle (radians)
Abstract base class for the CTA point spread function.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
GCTAPsf & operator=(const GCTAPsf &psf)
Assignment operator.
CTA response table class.
void read(const GFitsTable &table)
Read response table from FITS table HDU.
int table(const std::string &name) const
Determine index of table.
const int & elements(void) const
Return number of elements per table.
void axis_log10(const int &axis)
Set nodes for a logarithmic (base 10) axis.
void axis_radians(const int &axis)
Set nodes for a radians axis.
int axis(const std::string &name) const
Determine index of an axis.
const int & axes(void) const
Return number of axes of the tables.
void write(GFitsTable &table) const
Write response table into FITS table HDU.
int axis_bins(const int &axis) const
Return number bins in an axis.
const double & axis_hi(const int &axis, const int &bin) const
Return upper bin boundary for bin in axis.
const GNodeArray & axis_nodes(const int &axis) const
Return axis nodes.
void clear(void)
Clear response table.
const double & axis_lo(const int &axis, const int &bin) const
Return lower bin boundary for bin in axis.
std::string url(void) const
Return Uniform Resource Locator (URL)
std::string extname(const std::string &defaultname="") const
Return extension name.
void clear(void)
Clear file name.
Abstract interface for FITS table.
bool contains(const int &extno) const
Check if HDU exists in FITS file.
GFitsHDU * append(const GFitsHDU &hdu)
Append HDU to FITS file.
void close(void)
Close FITS file.
void remove(const int &extno)
Remove HDU from FITS file.
void save(const bool &clobber=false)
Saves FITS file.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
Random number generator class.
double uniform(void)
Returns random double precision floating value in range 0 to 1.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
bool is_infinite(const double &x)
Signal if argument is infinite.
bool is_notanumber(const double &x)
Signal if argument is not a number.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
const std::string extname_cta_psftable
std::string gadf_hduclas4(const GFits &fits, const std::string &hduclas4)
Return extension name for GADF response table of given HDU class 4.