Commit fc03fdabc9eaeb66ff5ea5f578873e37c0ca0c74

Authored by knodlseder
1 parent 3a3870ce

psf operator now also takes effective area as argument

inst/lat/include/GLATLtCube.hpp
1 1 /***************************************************************************
2   - * GLATLtCube.hpp - Fermi LAT lifetime cube *
  2 + * GLATLtCube.hpp - Fermi LAT livetime cube *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software; you can redistribute it and/or modify *
... ... @@ -12,7 +12,7 @@
12 12 ***************************************************************************/
13 13 /**
14 14 * @file GLATLtCube.hpp
15   - * @brief GLATLtCube class definition.
  15 + * @brief Fermi LAT livetime cube class definition.
16 16 * @author J. Knodlseder
17 17 */
18 18  
... ... @@ -34,9 +34,9 @@
34 34 /***********************************************************************//**
35 35 * @class GLATLtCube
36 36 *
37   - * @brief Interface for the Fermi LAT lifetime cube.
  37 + * @brief Interface for the Fermi LAT livetime cube.
38 38 *
39   - * The livetime cube holds the lifetime as function and zenith and azimuth
  39 + * The livetime cube holds the livetime as function and zenith and azimuth
40 40 * angles for a given observation. The azimuth dependence is optional.
41 41 ***************************************************************************/
42 42 class GLATLtCube {
... ... @@ -61,7 +61,8 @@ public:
61 61 double operator() (const GSkyDir& dir, const GEnergy& energy,
62 62 const GLATAeff& aeff);
63 63 double operator() (const GSkyDir& dir, const GEnergy& energy,
64   - const double& offset, const GLATPsf& psf);
  64 + const double& offset, const GLATPsf& psf,
  65 + const GLATAeff& aeff);
65 66  
66 67 // Methods
67 68 void clear(void);
... ...
inst/lat/src/GLATLtCube.cpp
1 1 /***************************************************************************
2   - * GLATLtCube.cpp - Fermi LAT lifetime cube *
  2 + * GLATLtCube.cpp - Fermi LAT livetime cube *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) 2010 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -16,6 +16,7 @@
16 16 #include <config.h>
17 17 #endif
18 18 #include "GLATLtCube.hpp"
  19 +#include "GTools.hpp"
19 20  
20 21 /* __ Method name definitions ____________________________________________ */
21 22  
... ... @@ -50,14 +51,14 @@ GLATLtCube::GLATLtCube(void)
50 51 /***********************************************************************//**
51 52 * @brief File constructor
52 53 *
53   - * @param[in] filename Lifetime cube filename.
  54 + * @param[in] filename Livetime cube filename.
54 55 ***************************************************************************/
55 56 GLATLtCube::GLATLtCube(const std::string& filename)
56 57 {
57 58 // Initialise class members
58 59 init_members();
59 60  
60   - // Load lifetime cube from file
  61 + // Load livetime cube from file
61 62 load(filename);
62 63  
63 64 // Return
... ... @@ -70,7 +71,7 @@ GLATLtCube::GLATLtCube(const std::string&amp; filename)
70 71 /***********************************************************************//**
71 72 * @brief Copy constructor
72 73 *
73   - * @param[in] cube Lifetime cube.
  74 + * @param[in] cube Livetime cube.
74 75 ***************************************************************************/
75 76 GLATLtCube::GLATLtCube(const GLATLtCube& cube)
76 77 {
... ... @@ -107,7 +108,7 @@ GLATLtCube::~GLATLtCube(void)
107 108 /***********************************************************************//**
108 109 * @brief Assignment operator
109 110 *
110   - * @param[in] cube Lifetime cube.
  111 + * @param[in] cube Livetime cube.
111 112 ***************************************************************************/
112 113 GLATLtCube& GLATLtCube::operator= (const GLATLtCube& cube)
113 114 {
... ... @@ -280,27 +281,31 @@ double GLATLtCube::operator() (const GSkyDir&amp; dir, const GEnergy&amp; energy,
280 281 * @param[in] energy Energy.
281 282 * @param[in] offset Offset from true direction (deg).
282 283 * @param[in] psf Point spread function.
  284 + * @param[in] aeff Effective area.
283 285 *
284 286 * Computes
285 287 * \f[\sum_{\cos \theta, \phi} T_{\rm corr.~live}(\cos \theta, \phi)
286   - * PSF(\log E, \delta, \cos \theta)\f]
  288 + * PSF(\log E, \delta, \cos \theta) A_{\rm eff}(\cos \theta, \phi)\f]
287 289 * where
288 290 * \f$T_{\rm corr.~live}(\cos \theta, \phi)\f$ is the efficiency corrected
289 291 * livetime as a function of the cosine of the zenith and of the azimuth
290   - * angle, and
  292 + * angle,
291 293 * \f$PSF(\log E, \delta, \cos \theta)\f$ is the point spread function that
292 294 * depends on
293 295 * the log10 of the energy (in MeV),
294 296 * the offset angle from the true direction (in degrees), and
295   - * the cosine of the zenith angle.
  297 + * the cosine of the zenith angle, and
  298 + * \f$A_{\rm eff}(\cos \theta, \phi)\f$ is the effective area that depends
  299 + * on the cosine of the zenith angle and (optionally) of the azimuth angle.
296 300 *
297 301 * @todo Implement computation of efficiency factors
298 302 ***************************************************************************/
299 303 double GLATLtCube::operator() (const GSkyDir& dir, const GEnergy& energy,
300   - const double& offset, const GLATPsf& psf)
  304 + const double& offset, const GLATPsf& psf,
  305 + const GLATAeff& aeff)
301 306 {
302 307 // Compute exposure
303   - double exposure = m_exposure(dir, energy, offset, psf);
  308 + double exposure = m_exposure(dir, energy, offset, psf, aeff);
304 309  
305 310 // Optionally compute livetime factors for trigger rate- and
306 311 // energy-dependent efficiency corrections
... ... @@ -312,7 +317,7 @@ double GLATLtCube::operator() (const GSkyDir&amp; dir, const GEnergy&amp; energy,
312 317 //m_efficiencyFactor->getLivetimeFactors(energy, f1, f2);
313 318  
314 319 // Compute correction
315   - double correction = m_weighted_exposure(dir, energy, offset, psf);
  320 + double correction = m_weighted_exposure(dir, energy, offset, psf, aeff);
316 321  
317 322 // Set exposure
318 323 exposure = f1 * exposure + f2 * correction;
... ... @@ -358,11 +363,12 @@ GLATLtCube* GLATLtCube::clone(void) const
358 363  
359 364  
360 365 /***********************************************************************//**
361   - * @brief Load lifetime cube from FITS file
  366 + * @brief Load livetime cube from FITS file
362 367 *
363 368 * @param[in] filename FITS file name.
364 369 *
365   - * @todo Loading of cos theta boundaries not yet implemented.
  370 + * @todo Loading of cos theta boundaries not yet implemented. This is not
  371 + * critical since they are not really needed.
366 372 ***************************************************************************/
367 373 void GLATLtCube::load(const std::string& filename)
368 374 {
... ... @@ -398,7 +404,7 @@ void GLATLtCube::load(const std::string&amp; filename)
398 404  
399 405  
400 406 /***********************************************************************//**
401   - * @brief Save lifetime cube into FITS file
  407 + * @brief Save livetime cube into FITS file
402 408 *
403 409 * @param[in] filename FITS file name.
404 410 * @param[in] clobber Overwrite existing file?
... ... @@ -413,7 +419,9 @@ void GLATLtCube::save(const std::string&amp; filename, bool clobber) const
413 419  
414 420  
415 421 /***********************************************************************//**
416   - * @brief Print lifetime cube information
  422 + * @brief Print livetime cube information
  423 + *
  424 + * @todo Implement GGti printing
417 425 ***************************************************************************/
418 426 std::string GLATLtCube::print(void) const
419 427 {
... ... @@ -422,6 +430,11 @@ std::string GLATLtCube::print(void) const
422 430  
423 431 // Append header
424 432 result.append("=== GLATLtCube ===");
  433 + result.append("\n"+parformat("Livetime correction"));
  434 + if (m_livetime_correct)
  435 + result.append("yes");
  436 + else
  437 + result.append("no");
425 438 result.append("\n"+m_exposure.print());
426 439 result.append("\n"+m_weighted_exposure.print());
427 440 //result.append("\n"+m_gti.print());
... ... @@ -456,7 +469,7 @@ void GLATLtCube::init_members(void)
456 469 /***********************************************************************//**
457 470 * @brief Copy class members
458 471 *
459   - * @param[in] cube Lifetime cube.
  472 + * @param[in] cube Livetime cube.
460 473 ***************************************************************************/
461 474 void GLATLtCube::copy_members(const GLATLtCube& cube)
462 475 {
... ... @@ -491,11 +504,11 @@ void GLATLtCube::free_members(void)
491 504 * @brief Output operator
492 505 *
493 506 * @param[in] os Output stream.
494   - * @param[in] cube Lifetime cube.
  507 + * @param[in] cube Livetime cube.
495 508 ***************************************************************************/
496 509 std::ostream& operator<< (std::ostream& os, const GLATLtCube& cube)
497 510 {
498   - // Write lifetime cube in output stream
  511 + // Write livetime cube in output stream
499 512 os << cube.print();
500 513  
501 514 // Return output stream
... ... @@ -507,11 +520,11 @@ std::ostream&amp; operator&lt;&lt; (std::ostream&amp; os, const GLATLtCube&amp; cube)
507 520 * @brief Log operator
508 521 *
509 522 * @param[in] log Logger.
510   - * @param[in] cube Lifetime cube.
  523 + * @param[in] cube Livetime cube.
511 524 ***************************************************************************/
512 525 GLog& operator<< (GLog& log, const GLATLtCube& cube)
513 526 {
514   - // Write lifetime cube into logger
  527 + // Write livetime cube into logger
515 528 log << cube.print();
516 529  
517 530 // Return logger
... ...