Commit ab65d3fcae067f9378be8bee75009013ea88d6d5

Authored by Jürgen Knödlseder
1 parent c4911769

Remove GCTAEventBin::emin() and emax() methods (no interface change in bugfix release)

inst/cta/include/GCTAEventBin.hpp
... ... @@ -80,8 +80,6 @@ public:
80 80 const int& ipix(void) const;
81 81 const int& ieng(void) const;
82 82 const double& solidangle(void) const;
83   - GEnergy emin(void) const;
84   - GEnergy emax(void) const;
85 83 const GEnergy& ewidth(void) const;
86 84 const double& ontime(void) const;
87 85 const double& weight(void) const;
... ... @@ -187,18 +185,4 @@ void GCTAEventBin::ieng(const int& ieng)
187 185 return;
188 186 }
189 187  
190   -
191   -/***********************************************************************//**
192   - * @brief Return maximum energy of event bin
193   - *
194   - * @return Maximum energy of event bin.
195   - *
196   - * Returns the maximum energy of event bin.
197   - ***************************************************************************/
198   -inline
199   -GEnergy GCTAEventBin::emax(void) const
200   -{
201   - return (emin() + ewidth());
202   -}
203   -
204 188 #endif /* GCTAEVENTBIN_HPP */
... ...
inst/cta/pyext/GCTAEventBin.i
... ... @@ -61,8 +61,6 @@ public:
61 61 const int& ipix(void) const;
62 62 const int& ieng(void) const;
63 63 const double& solidangle(void) const;
64   - GEnergy emin(void) const;
65   - GEnergy emax(void) const;
66 64 const GEnergy& ewidth(void) const;
67 65 const double& ontime(void) const;
68 66 const double& weight(void) const;
... ...
inst/cta/src/GCTAEventBin.cpp
... ... @@ -342,40 +342,6 @@ const double& GCTAEventBin::solidangle(void) const
342 342  
343 343  
344 344 /***********************************************************************//**
345   - * @brief Return minimum energy of event bin
346   - *
347   - * @return Minimum energy of event bin
348   - *
349   - * Returns minimum energy of event bin, computed using
350   - *
351   - * \f[
352   - * E_{\rm min} = \frac{-\Delta E + sqrt{\Delta E^2 + 4 E^2}}{2}
353   - * \f]
354   - *
355   - * where
356   - * \f$\Delta E\f$ is the energy bin width, returned by ewidth() and
357   - * \f$E\f$ is the energy, returned by energy().
358   - ***************************************************************************/
359   -GEnergy GCTAEventBin::emin(void) const
360   -{
361   - // Get energy and energy width in MeV
362   - double energy = this->energy().MeV();
363   - double ewidth = this->ewidth().MeV();
364   -
365   - // Compute minimum energy in MeV
366   - double arg = ewidth * ewidth + 4.0 * energy * energy;
367   - double e_min = 0.5 * (-ewidth + std::sqrt(arg));
368   -
369   - // Set minimum energy
370   - GEnergy emin;
371   - emin.MeV(e_min);
372   -
373   - // Return minimum energy
374   - return emin;
375   -}
376   -
377   -
378   -/***********************************************************************//**
379 345 * @brief Return energy width of event bin
380 346 *
381 347 * @return Energy width of event bin
... ...
inst/cta/src/GCTAModelIrfBackground.cpp
... ... @@ -360,11 +360,24 @@ double GCTAModelIrfBackground::eval(const GEvent& event,
360 360 spat = bgd(logE, inst_dir.detx(), inst_dir.dety());
361 361 }
362 362 else {
  363 + // Get pointer to event bin
363 364 const GCTAEventBin* bin = static_cast<const GCTAEventBin*>(&event);
364   - GEnergy emin = bin->emin();
365   - GEnergy emax = emin + bin->ewidth();
366   - double norm = 1.0 / bin->ewidth().MeV();
367   - spat = bgd.rate_ebin(inst_dir, emin, emax) * norm;
  365 +
  366 + // Get energy and energy width in MeV
  367 + double energy = bin->energy().MeV();
  368 + double ewidth = bin->ewidth().MeV();
  369 +
  370 + // Compute minimum energy in MeV
  371 + double arg = ewidth * ewidth + 4.0 * energy * energy;
  372 + double e_min = 0.5 * (-ewidth + std::sqrt(arg));
  373 +
  374 + // Set minimum and maximumenergy
  375 + GEnergy emin;
  376 + emin.MeV(e_min);
  377 + GEnergy emax = emin + bin->ewidth();
  378 +
  379 + // Compute spatial component
  380 + spat = bgd.rate_ebin(inst_dir, emin, emax) / ewidth;
368 381 }
369 382 #else
370 383 double logE = event.energy().log10TeV();
... ...
inst/cta/test/test_CTA.cpp
... ... @@ -2229,8 +2229,6 @@ void TestGCTAObservation::test_event_bin(void)
2229 2229 test_value(bin.ieng(), 7, "Check ieng() for filled bin");
2230 2230 test_value(bin.solidangle(), 3.14, 1.0e-10,
2231 2231 "Check solidangle() for filled bin");
2232   - test_value(bin.emin().TeV(), 1.996503, "Check emin() for filled bin");
2233   - test_value(bin.emax().TeV(), 2.003503, "Check emax() for filled bin");
2234 2232 test_value(bin.ewidth().GeV(), 7.0, 1.0e-10,
2235 2233 "Check ewidth() for filled bin");
2236 2234 test_value(bin.ontime(), 101.0, 1.0e-10, "Check ontime() for filled bin");
... ...