39 #define G_READ "GLATPsfV3::read(GFitsTable&)"
227 std::string msg =
"Number of elements in \"NCORE\" column ("+
229 "with the expected size ("+
231 "point spread function table.";
235 std::string msg =
"Number of elements in \"NTAIL\" column ("+
237 "with the expected size ("+
239 "point spread function table.";
243 std::string msg =
"Number of elements in \"SCORE\" column ("+
245 "with the expected size ("+
247 "point spread function table.";
251 std::string msg =
"Number of elements in \"STAIL\" column ("+
253 "with the expected size ("+
255 "point spread function table.";
259 std::string msg =
"Number of elements in \"GCORE\" column ("+
261 "with the expected size ("+
263 "point spread function table.";
267 std::string msg =
"Number of elements in \"GTAIL\" column ("+
269 "with the expected size ("+
271 "point spread function table.";
276 for (
int i = 0; i <
size; ++i) {
332 for (
int i = 0; i <
size; ++i) {
342 hdu_rpsf->
append(col_ncore);
343 hdu_rpsf->
append(col_ntail);
344 hdu_rpsf->
append(col_score);
345 hdu_rpsf->
append(col_stail);
346 hdu_rpsf->
append(col_gcore);
347 hdu_rpsf->
append(col_gtail);
350 std::string detnam = (
front()) ?
"FRONT" :
"BACK";
353 hdu_rpsf->
card(
"PSFVER", 3,
"File format version");
354 hdu_rpsf->
card(
"DETNAM", detnam,
"Detector section");
383 const double& ctheta)
403 double psf0 =
eval_psf(offset_rad, energy[0], index[0]);
404 double psf1 =
eval_psf(offset_rad, energy[1], index[1]);
405 double psf2 =
eval_psf(offset_rad, energy[2], index[2]);
406 double psf3 =
eval_psf(offset_rad, energy[3], index[3]);
409 psf = weight[0] * psf0 + weight[1] * psf1 +
410 weight[2] * psf2 + weight[3] * psf3;
434 result.append(
"=== GLATPsfV3 ===");
512 double base = (gamma == 1)
513 ? (1.0 - 1.0/1.001) *
std::pow(1.0 + u/1.001, -1.001)
514 : (1.0 - 1.0/gamma) *
std::pow(1.0 + u/gamma, -gamma);
537 double integral = 1.0 -
std::pow(1.0 + u/gamma, 1.0 - gamma);
568 double score(
m_score[index] * scale);
569 double stail(
m_stail[index] * scale);
574 double rc = offset / score;
575 double uc = 0.5 * rc * rc;
576 double rt = offset / stail;
577 double ut = 0.5 * rt * rt;
620 double score(
m_score[index] * scale);
621 double stail(
m_stail[index] * scale);
630 #if defined(G_APPROXIMATE_PSF_INTEGRAL)
643 #if defined(G_APPROXIMATE_PSF_INTEGRAL)
651 double uc = 0.5 * rc * rc;
654 double ut = 0.5 * rt * rt;
658 psf = ncore * (
base_int(uc, gcore) * sc +
700 #if defined(G_CHECK_PSF_NORM)
704 double score(
m_score[index] * scale);
705 double stail(
m_stail[index] * scale);
711 std::cout <<
"Energy=" << energy;
713 std::cout <<
" error=" << sum-1.0 << std::endl;
std::vector< double > m_ncore
PSF ncore parameter.
void number(const int &number)
Set number of elements in column.
GLATPsfV3 & operator=(const GLATPsfV3 &psf)
Assignment operator.
double norm(const GVector &vector)
Computes vector norm.
double romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
void read(const GFitsTable &hdu)
Read response table from FITS table HDU.
void read(const GFitsTable &table)
Read point spread function from FITS table.
void write(GFits &file) const
Write point spread function into FITS file.
void free_members(void)
Delete class members.
std::vector< double > energies(void) const
Return energies of 4 corners used for interpolation.
double sum(const GVector &vector)
Computes vector sum.
GFitsTableCol * append(const GFitsTableCol &column)
Append column to the table.
void write(GFitsTable &hdu) const
Write response table into FITS table.
FITS table float column class interface definition.
GIntegral class interface definition.
GLATPsfV3(void)
Void constructor.
double scale_factor(const double &energy) const
Return scale factor for energy (in MeV)
double psf(const double &offset, const double &logE, const double &ctheta)
Return point spread function value.
std::vector< double > m_gtail
PSF gtail parameter.
Fermi/LAT point spread function version 3 class definition.
static double base_int(const double &u, const double &gamma)
Return approximation of point spread base function integral.
double integrate_psf(const double &energy, const int &index)
Integrates PSF for a specific set of parameters.
void free_members(void)
Delete class members.
Abstract Fermi/LAT point spread function base class.
const int & nenergies(void) const
Return number of energies in response table.
Abstract interface for FITS table column.
std::vector< double > m_score
PSF score parameter.
virtual ~GLATPsfV3(void)
Destructor.
std::vector< double > m_ntail
PSF ntail parameter.
const int & ncostheta(void) const
Return number of cosine theta bins in response table.
Abstract interface for FITS table.
double eval_psf(const double &offset, const double &energy, const int &index)
Evaluate PSF for a specific set of parameters.
void init_members(void)
Initialise class members.
const std::string & extname(void) const
Return extension name.
double m_min_ctheta
Minimum valid cos(theta)
GLATPsfBase & operator=(const GLATPsfBase &psf)
Assignment operator.
GLATResponseTable m_rpsf_bins
PSF energy and cos theta binning.
void set(const double &logE, const double &ctheta)
Set indices and weighting for bi-linear interpolation of 2D array.
int index(const int &ie, const int &ic) const
Return table index.
virtual double real(const int &row, const int &inx=0) const =0
GVector pow(const GVector &vector, const double &power)
Computes tanh of vector elements.
int size(void) const
Return number of bins in point spread function.
std::vector< double > m_gcore
PSF gcore parameter.
void init_members(void)
Initialise class members.
Exception handler interface definition.
GFitsHDU * append(const GFitsHDU &hdu)
Append HDU to FITS file.
void copy_members(const GLATPsfV3 &psf)
Copy class members.
FITS binary table class definition.
void normalize_psf(void)
Normalize PSF for all parameters.
double costheta_lo(const int &inx) const
Return lower bin cos theta [.
std::vector< double > m_stail
PSF stail parameter.
static double base_fct(const double &u, const double &gamma)
Return point spread base function value.
double energy(const int &ie) const
Return mean energy of bin (units: MeV)
Integration class interface definition.
GFitsHeaderCard & card(const int &cardno)
Return header card.
std::vector< double > weights(void) const
Return weights of 4 corners used for interpolation.
const bool & front(void) const
Signal that point spread function is for front section.
int size(void) const
Return number of bins in response table.
GLATPsfV3 * clone(void) const
Clone point spread function.
void clear(void)
Clear point spread function.
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function.
Mathematical function definitions.
std::vector< int > indices(void) const
Return indices of 4 corners used for interpolation.
Fermi/LAT point spread function version 3 class.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.