Commit d414a9caa327dfe8dad68645ce04831be886eed0

Authored by Jürgen Knödlseder
2 parents 369ca23c 16cdadee

Merge branch '1298-add-exception-if-RoI-is-missing' into integration

inst/cta/src/GCTACubeBackground.cpp
... ... @@ -45,6 +45,7 @@
45 45 /* __ Method name definitions ____________________________________________ */
46 46 #define G_READ "GCTACubeBackground::read(GFits&)"
47 47 #define G_MC "GCTACubeBackground::mc(GEnergy&, GTime&, GRan&)"
  48 +#define G_FILL "GCTACubeBackground::fill(GObservations&, GLog*)"
48 49  
49 50 /* __ Macros _____________________________________________________________ */
50 51  
... ... @@ -326,6 +327,14 @@ void GCTACubeBackground::fill(const GObservations& obs, GLog* log)
326 327 // Extract region of interest from CTA observation
327 328 GCTARoi roi = cta->roi();
328 329  
  330 + // Check for RoI sanity
  331 + if (!roi.is_valid()) {
  332 + std::string msg = "No RoI information found in input observation "
  333 + "\""+cta->name()+"\". Run ctselect to specify "
  334 + "an RoI for this observation";
  335 + throw GException::invalid_value(G_FILL, msg);
  336 + }
  337 +
329 338 // Set GTI of actual observations as the GTI of the event cube
330 339 eventcube.gti(cta->gti());
331 340  
... ...
inst/cta/src/GCTACubeExposure.cpp
... ... @@ -37,6 +37,8 @@
37 37 #include "GLog.hpp"
38 38  
39 39 /* __ Method name definitions ____________________________________________ */
  40 +#define G_SET "GCTACubeExposure::set(GCTAObservation&)"
  41 +#define G_FILL "GCTACubeExposure::fill(GObservations&, GLog*)"
40 42  
41 43 /* __ Macros _____________________________________________________________ */
42 44  
... ... @@ -311,6 +313,14 @@ void GCTACubeExposure::set(const GCTAObservation& obs)
311 313 // Extract region of interest from CTA observation
312 314 GCTARoi roi = obs.roi();
313 315  
  316 + // Check for RoI sanity
  317 + if (!roi.is_valid()) {
  318 + std::string msg = "No RoI information found in input observation "
  319 + "\""+obs.name()+"\". Run ctselect to specify "
  320 + "an RoI for this observation";
  321 + throw GException::invalid_value(G_SET, msg);
  322 + }
  323 +
314 324 // Get references on CTA response and pointing direction
315 325 const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*>(obs.response());
316 326 const GSkyDir& pnt = obs.pointing().dir();
... ... @@ -413,6 +423,14 @@ void GCTACubeExposure::fill(const GObservations&amp; obs, GLog* log)
413 423 // Extract region of interest from CTA observation
414 424 GCTARoi roi = cta->roi();
415 425  
  426 + // Check for RoI sanity
  427 + if (!roi.is_valid()) {
  428 + std::string msg = "No RoI information found in input observation "
  429 + "\""+cta->name()+"\". Run ctselect to specify "
  430 + "an RoI for this observation";
  431 + throw GException::invalid_value(G_FILL, msg);
  432 + }
  433 +
416 434 // Get references on CTA response and pointing direction
417 435 const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*>(cta->response());
418 436 const GSkyDir& pnt = cta->pointing().dir();
... ...
inst/cta/src/GCTACubePsf.cpp
... ... @@ -38,6 +38,7 @@
38 38  
39 39 /* __ Method name definitions ____________________________________________ */
40 40 #define G_SET "GCTACubePsf::set(GCTAObservation&)"
  41 +#define G_FILL "GCTACubePsf::fill(GObservations&, GLog*)"
41 42  
42 43 /* __ Macros _____________________________________________________________ */
43 44  
... ... @@ -372,6 +373,14 @@ void GCTACubePsf::set(const GCTAObservation&amp; obs)
372 373 }
373 374 const GCTARoi& roi = list->roi();
374 375  
  376 + // Check for RoI sanity
  377 + if (!roi.is_valid()) {
  378 + std::string msg = "No RoI information found in input observation "
  379 + "\""+obs.name()+"\". Run ctselect to specify "
  380 + "an RoI for this observation";
  381 + throw GException::invalid_value(G_SET, msg);
  382 + }
  383 +
375 384 // Get references on CTA response and pointing direction
376 385 const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*>(obs.response());
377 386 const GSkyDir& pnt = obs.pointing().dir();
... ... @@ -478,6 +487,14 @@ void GCTACubePsf::fill(const GObservations&amp; obs, GLog* log)
478 487 // Extract region of interest from CTA observation
479 488 GCTARoi roi = cta->roi();
480 489  
  490 + // Check for RoI sanity
  491 + if (!roi.is_valid()) {
  492 + std::string msg = "No RoI information found in input observation "
  493 + "\""+cta->name()+"\". Run ctselect to specify "
  494 + "an RoI for this observation";
  495 + throw GException::invalid_value(G_FILL, msg);
  496 + }
  497 +
481 498 // Get references on CTA response and pointing direction
482 499 const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*>(cta->response());
483 500 const GSkyDir& pnt = cta->pointing().dir();
... ...