Commit 049485d844c01cc491b26e01fa3fbd13b0eea98d

Authored by Jürgen Knödlseder
1 parent 81931656

Adapt to new GCTAResponseTable interface

inst/cta/src/GCTABackground3D.cpp
1 1 /***************************************************************************
2 2 * GCTABackground3D.cpp - CTA 3D background class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -190,9 +190,9 @@ double GCTABackground3D::operator()(const double& logE,
190 190 // Get background rate
191 191 #if defined(G_LOG_INTERPOLATION)
192 192 // Retrieve node arrays
193   - const GNodeArray& detx_nodes = m_background.nodes(0);
194   - const GNodeArray& dety_nodes = m_background.nodes(1);
195   - const GNodeArray& energy_nodes = m_background.nodes(2);
  193 + const GNodeArray& detx_nodes = m_background.axis_nodes(0);
  194 + const GNodeArray& dety_nodes = m_background.axis_nodes(1);
  195 + const GNodeArray& energy_nodes = m_background.axis_nodes(2);
196 196  
197 197 // Set values for node arrays
198 198 detx_nodes.set_value(detx);
... ... @@ -225,7 +225,8 @@ double GCTABackground3D::operator()(const double& logE,
225 225 double wgt_emax = energy_nodes.wgt_right();
226 226  
227 227 // Compute offsets in energy dimension
228   - int npixels = m_background.axis(0) * m_background.axis(1);
  228 + int npixels = m_background.axis_bins(0) *
  229 + m_background.axis_bins(1);
229 230 int offset_emin = inx_emin * npixels;
230 231 int offset_emax = inx_emax * npixels;
231 232  
... ... @@ -496,7 +497,7 @@ GCTAInstDir GCTABackground3D::mc(const GEnergy& energy,
496 497 " in the range ["+
497 498 gammalib::str(m_background.axis_lo(2,0))+
498 499 " "+m_background.axis_lo_unit(2)+" - "+
499   - gammalib::str(m_background.axis_hi(2,m_background.axis(2)-1))+
  500 + gammalib::str(m_background.axis_hi(2,m_background.axis_bins(2)-1))+
500 501 " "+m_background.axis_hi_unit(2)+"].";
501 502 throw GException::invalid_value(G_MC, msg);
502 503 }
... ... @@ -564,23 +565,23 @@ std::string GCTABackground3D::print(const GChatter& chatter) const
564 565  
565 566 // Compute DETX boundaries in deg
566 567 double detx_min = m_background.axis_lo(0,0);
567   - double detx_max = m_background.axis_hi(0,m_background.axis(0)-1);
  568 + double detx_max = m_background.axis_hi(0,m_background.axis_bins(0)-1);
568 569  
569 570 // Compute DETY boundaries in deg
570 571 double dety_min = m_background.axis_lo(1,0);
571   - double dety_max = m_background.axis_hi(1,m_background.axis(1)-1);
  572 + double dety_max = m_background.axis_hi(1,m_background.axis_bins(1)-1);
572 573  
573 574 // Compute energy boundaries in TeV
574 575 double emin = m_background.axis_lo(2,0);
575   - double emax = m_background.axis_hi(2,m_background.axis(2)-1);
  576 + double emax = m_background.axis_hi(2,m_background.axis_bins(2)-1);
576 577  
577 578 // Append information
578 579 result.append("\n"+gammalib::parformat("Number of DETX bins") +
579   - gammalib::str(m_background.axis(0)));
  580 + gammalib::str(m_background.axis_bins(0)));
580 581 result.append("\n"+gammalib::parformat("Number of DETY bins") +
581   - gammalib::str(m_background.axis(1)));
  582 + gammalib::str(m_background.axis_bins(1)));
582 583 result.append("\n"+gammalib::parformat("Number of energy bins") +
583   - gammalib::str(m_background.axis(2)));
  584 + gammalib::str(m_background.axis_bins(2)));
584 585 result.append("\n"+gammalib::parformat("DETX range"));
585 586 result.append(gammalib::str(detx_min)+" - "+gammalib::str(detx_max)+" deg");
586 587 result.append("\n"+gammalib::parformat("DETX range"));
... ... @@ -723,9 +724,9 @@ void GCTABackground3D::init_mc_cache(void) const
723 724 }
724 725  
725 726 // Determine number of response cube pixels and maps
726   - m_mc_nx = m_background.axis(0);
727   - m_mc_ny = m_background.axis(1);
728   - m_mc_nmaps = m_background.axis(2);
  727 + m_mc_nx = m_background.axis_bins(0);
  728 + m_mc_ny = m_background.axis_bins(1);
  729 + m_mc_nmaps = m_background.axis_bins(2);
729 730  
730 731 // Compute DETX boundaries and binsize in deg. If DETX binsize is too
731 732 // coarse then request a finer sampling
... ...
inst/cta/src/GCTAEdisp2D.cpp
... ... @@ -294,9 +294,9 @@ void GCTAEdisp2D::read(const GFitsTable& table)
294 294 m_edisp.axis_radians(2);
295 295  
296 296 // Get axes dimensions
297   - int etrue_size = m_edisp.axis(0);
298   - int migra_size = m_edisp.axis(1);
299   - int theta_size = m_edisp.axis(2);
  297 + int etrue_size = m_edisp.axis_bins(0);
  298 + int migra_size = m_edisp.axis_bins(1);
  299 + int theta_size = m_edisp.axis_bins(2);
300 300  
301 301 // Now normalize the migration matrix vectors. We do this by integrating
302 302 // for each true energy and offset angle the measured energy. We perform
... ... @@ -619,11 +619,11 @@ std::string GCTAEdisp2D::print(const GChatter& chatter) const
619 619  
620 620 // Compute energy boundaries in TeV
621 621 double emin = m_edisp.axis_lo(0,0);
622   - double emax = m_edisp.axis_hi(0,m_edisp.axis(0)-1);
  622 + double emax = m_edisp.axis_hi(0,m_edisp.axis_bins(0)-1);
623 623  
624 624 // Compute offset angle boundaries in deg
625 625 double omin = m_edisp.axis_lo(1,0);
626   - double omax = m_edisp.axis_hi(1,m_edisp.axis(1)-1);
  626 + double omax = m_edisp.axis_hi(1,m_edisp.axis_bins(1)-1);
627 627  
628 628 // Append header
629 629 result.append("=== GCTAEdisp2D ===");
... ... @@ -631,9 +631,9 @@ std::string GCTAEdisp2D::print(const GChatter& chatter) const
631 631 // Append information
632 632 result.append("\n"+gammalib::parformat("Filename")+m_filename);
633 633 result.append("\n"+gammalib::parformat("Number of energy bins") +
634   - gammalib::str(m_edisp.axis(0)));
  634 + gammalib::str(m_edisp.axis_bins(0)));
635 635 result.append("\n"+gammalib::parformat("Number of offset bins") +
636   - gammalib::str(m_edisp.axis(1)));
  636 + gammalib::str(m_edisp.axis_bins(1)));
637 637 result.append("\n"+gammalib::parformat("Log10(Energy) range"));
638 638 result.append(gammalib::str(emin)+" - "+gammalib::str(emax)+" TeV");
639 639 result.append("\n"+gammalib::parformat("Offset angle range"));
... ... @@ -744,7 +744,7 @@ void GCTAEdisp2D::compute_ebounds_obs(const double& theta,
744 744 const double eps = 1.0e-12;
745 745  
746 746 // Loop over Esrc
747   - for (int isrc = 0; isrc < m_edisp.axis(0); ++isrc) {
  747 + for (int isrc = 0; isrc < m_edisp.axis_bins(0); ++isrc) {
748 748  
749 749 // Set Esrc
750 750 double Esrc = std::sqrt(m_edisp.axis_hi(0,isrc) *
... ... @@ -758,7 +758,7 @@ void GCTAEdisp2D::compute_ebounds_obs(const double&amp; theta,
758 758 bool maxFound = false;
759 759  
760 760 // Determine number of MIGRA bins
761   - int n_migra = m_edisp.axis(1);
  761 + int n_migra = m_edisp.axis_bins(1);
762 762  
763 763 // Find minimum boundary
764 764 for (int i = 0; i < n_migra; ++i) {
... ...
inst/cta/src/GCTAPsf2D.cpp
1 1 /***************************************************************************
2 2 * GCTAPsf2D.cpp - CTA 2D point spread function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -627,11 +627,11 @@ std::string GCTAPsf2D::print(const GChatter&amp; chatter) const
627 627  
628 628 // Compute energy boundaries in TeV
629 629 double emin = m_psf.axis_lo(0,0);
630   - double emax = m_psf.axis_hi(0,m_psf.axis(0)-1);
  630 + double emax = m_psf.axis_hi(0,m_psf.axis_bins(0)-1);
631 631  
632 632 // Compute offset angle boundaries in deg
633 633 double omin = m_psf.axis_lo(1,0);
634   - double omax = m_psf.axis_hi(1,m_psf.axis(1)-1);
  634 + double omax = m_psf.axis_hi(1,m_psf.axis_bins(1)-1);
635 635  
636 636 // Append header
637 637 result.append("=== GCTAPsf2D ===");
... ... @@ -639,9 +639,9 @@ std::string GCTAPsf2D::print(const GChatter&amp; chatter) const
639 639 // Append information
640 640 result.append("\n"+gammalib::parformat("Filename")+m_filename);
641 641 result.append("\n"+gammalib::parformat("Number of energy bins") +
642   - gammalib::str(m_psf.axis(0)));
  642 + gammalib::str(m_psf.axis_bins(0)));
643 643 result.append("\n"+gammalib::parformat("Number of offset bins") +
644   - gammalib::str(m_psf.axis(1)));
  644 + gammalib::str(m_psf.axis_bins(1)));
645 645 result.append("\n"+gammalib::parformat("Log10(Energy) range"));
646 646 result.append(gammalib::str(emin)+" - "+gammalib::str(emax)+" TeV");
647 647 result.append("\n"+gammalib::parformat("Offset angle range"));
... ...