42 #define G_SET "GLATMeanPsf::set(GSkyDir&, GLATObservation&)"
43 #define G_EXPOSURE "GLATMeanPsf::exposure(int&)"
50 #define G_SIGNAL_NEGATIVE_MEAN_PSF
51 //#define G_DEBUG_INTEGRAL
52 //#define G_DEBUG_MAP_CORRECTIONS
181 if (offset < 70.0 && logE > 0.0) {
237 #if defined(G_SIGNAL_NEGATIVE_MEAN_PSF)
239 std::cout <<
"GLATMeanPsf::operator()(offset=" <<
offset;
240 std::cout <<
", logE=" << logE <<
") = " << value << std::endl;
310 if (ltcube == NULL) {
311 std::string msg =
"Observation does not contain a livetime cube. "
312 "Please specify an observation containing a livetime "
342 std::vector<GEnergy>
energy;
343 energy.reserve(ebds.
size()+1);
344 energy.push_back(ebds.
emin(0));
346 for (
int i = 0; i < ebds.
size(); ++i) {
348 energy.push_back(ebds.
emax(i));
352 for (
int ieng = 0; ieng < energy.size(); ++ieng) {
356 for (
int i = 0; i < rsp->
size(); ++i) {
357 exposure += (*ltcube)(
dir, energy[ieng], *rsp->
aeff(i));
364 for (
int ioffset = 0; ioffset <
m_offset.
size(); ++ioffset) {
368 for (
int i = 0; i < rsp->
size(); ++i) {
369 psf += (*ltcube)(
dir, energy[ieng],
m_offset[ioffset],
374 psf = (exposure > 0.0) ? psf/exposure : 0.0;
377 m_psf.push_back(psf);
417 if (offset < 70.0 && logE > 0.0) {
473 #if defined(G_SIGNAL_NEGATIVE_MEAN_PSF)
475 std::cout <<
"GLATMeanPsf::psf(offset=" <<
offset;
476 std::cout <<
", logE=" << logE <<
") = " << value << std::endl;
540 double min_exposure = 0.0;
541 double max_exposure = 0.0;
558 result.append(
"=== GLATMeanPsf ===");
681 const double offset_min = 1.0e-4;
682 const double offset_max = 70.0;
683 const int offset_num = 200;
689 double step =
log(offset_max/offset_min)/(offset_num - 1.0);
690 for (
int i = 0; i < offset_num; ++i)
729 #if defined(G_DEBUG_MAP_CORRECTIONS)
730 std::cout <<
"GLATMeanPsf::set_map_corrections:";
731 std::cout <<
" radius=" << radius << std::endl;
739 for (
int iy = 0; iy < cube->
ny(); ++iy) {
740 for (
int ix = 0; ix < cube->
nx(); ++ix) {
745 double solidangle = cube->
map().solidangle(pixel);
748 if (offset <= radius) {
752 sum[ieng] +=
psf(offset,
m_energy[ieng]) * solidangle;
762 if (sum[ieng] > 0.0) {
792 double int_left = 0.0;
793 double int_right = 0.0;
803 int_left += 0.5 * (
m_psf[inx_energy_left+i] *
sin(theta_min) +
804 m_psf[inx_energy_left+i+1] *
sin(theta_max)) *
805 (theta_max - theta_min);
806 int_right += 0.5 * (
m_psf[inx_energy_right+i] *
sin(theta_min) +
807 m_psf[inx_energy_right+i+1] *
sin(theta_max)) *
808 (theta_max - theta_min);
820 int_left += 0.5 * (
m_psf[inx_energy_left+i] *
sin(theta_min) +
821 psf_left *
sin(theta_max)) *
822 (theta_max - theta_min);
823 int_right += 0.5 * (
m_psf[inx_energy_right+i] *
sin(theta_min) +
824 psf_right *
sin(theta_max)) *
825 (theta_max - theta_min);
828 #if defined(G_DEBUG_INTEGRAL)
829 std::cout <<
"offsetmax=" << offsetmax;
832 std::cout <<
" i=" << i;
833 std::cout <<
" psf_left=" << psf_left;
834 std::cout <<
" psf_right=" << psf_right;
848 #if defined(G_DEBUG_INTEGRAL)
849 std::cout <<
" integral=" << integral << std::endl;
Fermi/LAT observation class.
int size(void) const
Return number of nodes in node array.
std::string m_name
Source name for mean PSF.
const GSkyDir & dir(void) const
Return sky direction for mean PSF.
virtual void response(const GResponse &rsp)
Set response function.
Fermi/LAT observation class definition.
double m_theta_max
Maximum inclination angle (default 70 deg)
int size(void) const
Return number of event types.
double dec_deg(void) const
Returns Declination in degrees.
double operator()(const double &offset, const double &logE)
Return mean PSF*exposure value.
const std::string & name(void) const
Return source name for mean PSF.
double m_wgt4
Weighting factor 4.
void init_members(void)
Initialise class members.
const double & offset(const int &inx) const
Return offset angle for given bin.
void ebounds(const GEbounds &ebounds)
Set energy boundaries.
int size(void) const
Return number of energy boundaries.
int m_inx2_exp
Exposure index 2.
double maxrad(const GSkyDir &dir) const
Computes the maximum radius (in degrees) around a given source direction that fits spatially into the...
GLATMeanPsf * clone(void) const
Clone mean PSF.
GLATPsf * psf(const int &index) const
Return pointer on point spread function.
int nx(void) const
Return number of bins in X direction.
const double & wgt_left(void) const
Returns left node weight.
Fermi/LAT Response class.
void free_members(void)
Delete class members.
void clear(void)
Clear node array.
double sum(const GVector &vector)
Computes vector sum.
void set_offsets(void)
Set array of offset values in degrees.
int size(void) const
Return number of bins in mean PSF.
void set_value(const double &value) const
Set indices and weighting factors for interpolation.
GLATMeanPsf & operator=(const GLATMeanPsf &cube)
Assignment operator.
double log10MeV(void) const
Return log10 of energy in MeV.
double exposure(const double &logE)
Return exposure value.
GLATMeanPsf(void)
Void constructor.
void clear(void)
Clear mean PSF.
const double & wgt_right(void) const
Returns right node weight.
double m_wgt1
Weighting factor 1.
Energy boundaries container class.
const GLATLtCube * ltcube(void) const
Return Fermi/LAT livetime cube.
GSkyDir m_dir
Source direction for mean PSF.
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
const GEnergy & emin(void) const
Return minimum energy of all intervals.
double m_last_energy
Last requested logE value.
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
double ra_deg(void) const
Returns Right Ascension in degrees.
Fermi/LAT event cube class definition.
std::vector< double > m_mapcorr
Map corrections.
double m_last_offset
Last requested offset value.
const int & inx_left(void) const
Returns left node index.
Fermi LAT point spread function class definition.
Fermi/LAT event cube class.
GNodeArray m_offset
Offsets of mean PSF.
GLATAeff * aeff(const int &index) const
Return pointer on effective area.
void set(const GSkyDir &dir, const GLATObservation &obs)
Compute mean PSF and exposure.
double m_wgt3
Weighting factor 3.
std::vector< double > m_psf
Mean PSF values.
Fermi/LAT mean PSF class definition.
double psf(const double &offset, const double &logE)
Return mean PSF value.
double m_wgt2
Weighting factor 2.
const int & inx_right(void) const
Returns right node index.
void map(const GSkyMap &map)
Set event cube from sky map.
void copy_members(const GLATMeanPsf &psf)
Copy class members.
double integral(const double &radmax, const double &logE)
Compute integral over PSF.
std::vector< double > m_exposure
Mean exposure.
void clear(void)
Clear sky direction.
int nenergies(void) const
Return number of energy bins.
GVector sin(const GVector &vector)
Computes sine of vector elements.
virtual GEvents * events(void)
Return events.
Exception handler interface definition.
Fermi/LAT mean PSF class.
std::string print(const GChatter &chatter=NORMAL) const
Print livetime cube information.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
int noffsets(void) const
Return number of offset bins.
GNodeArray m_energy
log10(energy) of mean PSF
const GEnergy & emax(void) const
Return maximum energy of all intervals.
Fermi LAT effective area class definition.
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.
int m_inx1_exp
Exposure index 1.
virtual ~GLATMeanPsf(void)
Destructor.
const double & energy(const int &inx) const
Return energy for given bin.
void set_map_corrections(const GLATObservation &obs)
Compute map corrections.
int ny(void) const
Return number of bins in Y direction.
Interface for the Fermi LAT livetime cube.
Mathematical function definitions.
Class that handles energies in a unit independent way.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.