43 #define G_READ "GCTAPsf2D::read(GFitsTable&)"
44 #define G_CONTAINMENT_RADIUS "GCTAPsf2D::containment_radius(double&,"\
45 " double&, double&, double&, double&, double&, bool&)"
191 const double& zenith,
192 const double& azimuth,
193 const bool& etrue)
const
195 #if defined(G_SMOOTH_PSF)
199 static const double offset =
std::exp(-0.5*5.0*5.0);
212 double delta2 = delta * delta;
215 #if defined(G_SMOOTH_PSF)
234 #if defined(G_SMOOTH_PSF)
330 std::string msg =
"Expected two-dimensional point spread function "
331 "response table but found "+
333 " dimensions. Please specify a two-dimensional "
334 "point spread function.";
400 GFits fits(filename);
405 if (extname.empty()) {
447 if (fits.contains(extname)) {
488 const double& zenith,
489 const double& azimuth,
490 const bool& etrue)
const
500 double sum = sum1 + sum2 + sum3;
502 if (sum2 > 0.0 && u >= sum2) {
505 else if (sum1 > 0.0 && u >= sum1) {
510 double delta = sigma * ran.
chisq2();
534 const double& zenith,
535 const double& azimuth,
536 const bool& etrue)
const
547 double radius = 5.0 * sigma;
590 const double& zenith,
591 const double& azimuth,
592 const bool& etrue)
const
596 const int itermax = 20;
597 const double convergence = 1.0e-6;
600 if (fraction <= 0.0 || fraction >= 1.0) {
601 std::string message =
"Containment fraction "+
603 "0.0 and 1.0, not inclusive.";
611 double amax =
delta_max(logE, theta, phi, zenith, azimuth, etrue);
612 double amin = 0.000001 * amax;
615 double a = 0.20 * amax;
624 for (; iter < itermax; ++iter) {
636 fa += norm1 * (1.0 - exp1);
637 fa += norm2 * (1.0 - exp2);
638 fa += norm3 * (1.0 - exp3);
671 if (iter == itermax-1) {
672 std::string msg =
"Unable to converge within " +
698 result.append(
"=== GCTAPsf2D ===");
880 m_norm = (integral > 0.0) ? 1.0 / integral : 0.0;
void free_members(void)
Delete class members.
#define G_CONTAINMENT_RADIUS
double chisq2(void)
Returns Chi2 deviates for 2 degrees of freedom.
virtual ~GCTAPsf2D(void)
Destructor.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
GCTAResponseTable m_psf
PSF response table.
GCTAPsf2D & operator=(const GCTAPsf2D &psf)
Assignment operator.
Random number generator class definition.
void warning(const std::string &origin, const std::string &message)
Emits warning.
GFilename filename(void) const
Return filename.
GVector abs(const GVector &vector)
Computes absolute of vector elements.
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.
GCTAPsf2D(void)
Void constructor.
Abstract base class for the CTA point spread function.
int m_inx_energy
Energy index.
double sum(const GVector &vector)
Computes vector sum.
std::string extname(const std::string &defaultname="") const
Return extension name.
double m_width1
Gaussian 1 width.
Random number generator class.
double m_norm
Global normalization.
const int & tables(void) const
Return number of tables.
double m_sigma2
Gaussian 2 sigma.
void scale(const int &table, const double &scale)
Scale table.
void axis_radians(const int &axis)
Set nodes for a radians axis.
GCTAPsf & operator=(const GCTAPsf &psf)
Assignment operator.
FITS file class interface definition.
double m_par_theta
Cache offset angle.
int m_inx_ampl3
3nd Gaussian relative amplitude
void read(const GFitsTable &table)
Read response table from FITS table HDU.
CTA 2D point spread function class.
void init_members(void)
Initialise class members.
void copy_members(const GCTAPsf2D &psf)
Copy class members.
const double & axis_lo(const int &axis, const int &bin) const
Return lower bin boundary for bin in axis.
Definition of support function used by CTA classes.
const GCTAResponseTable & table(void) const
Return response table.
void write(GFitsTable &table) const
Write response table into FITS table HDU.
int axis(const std::string &name) const
Determine index of an axis.
void update(const double &logE, const double &theta) const
Update PSF parameter cache.
int m_inx_ampl2
2nd Gaussian relative amplitude
int m_inx_sigma3
3nd Gaussian sigma
const std::string extname_cta_psf2d
void remove(const int &extno)
Remove HDU from FITS file.
void clear(void)
Clear response table.
double m_width2
Gaussian 2 width.
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function information.
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)
double uniform(void)
Returns random double precision floating value in range 0 to 1.
Abstract interface for FITS table.
double m_norm3
Gaussian 3 normalization.
double m_sigma3
Gaussian 3 sigma.
CTA 2D point spread function class definition.
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 save(const GFilename &filename, const bool &clobber=false) const
Save point spread function table into FITS file.
void load(const GFilename &filename)
Load point spread function from FITS file.
const std::string & extname(void) const
Return extension name.
void axis_log10(const int &axis)
Set nodes for a logarithmic (base 10) axis.
int table(const std::string &name) const
Determine index of table.
void init_members(void)
Initialise class members.
std::string gadf_hduclas4(const GFits &fits, const std::string &hduclas4)
Return extension name for GADF response table of given HDU class 4.
int m_inx_sigma1
1st Gaussian sigma
int m_inx_sigma2
2nd Gaussian sigma
std::string url(void) const
Return Uniform Resource Locator (URL)
int axis_bins(const int &axis) const
Return number bins in an axis.
void clear(void)
Clear file name.
void clear(void)
Clear point spread function.
void write(GFitsBinTable &table) const
Write point spread function into FITS binary table.
const double & axis_hi(const int &axis, const int &bin) const
Return upper bin boundary for bin in axis.
int m_inx_theta
Theta 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)
double m_par_logE
Cache energy.
Exception handler interface definition.
void free_members(void)
Delete class members.
FITS binary table class definition.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
CTA response table class.
GCTAPsf2D * clone(void) const
Clone point spread functions.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
double m_sigma1
Gaussian 1 sigma.
double m_width3
Gaussian 3 width.
void close(void)
Close FITS file.
const int & axes(void) const
Return number of axes of the tables.
GFilename m_filename
Name of Aeff response file.
Filename class interface definition.
Mathematical function definitions.
double m_norm2
Gaussian 2 normalization.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.