Commit e40ac86ce66f115626faf61e446ac182cb4b6c5f

Authored by Michael Mayer
1 parent 6955c7c0

Added check if RoI information are valid and throw a meaningful excpetion if it is not the case

Showing 1 changed file with 9 additions and 0 deletions
src/ctbin/ctbin.cpp
... ... @@ -455,6 +455,15 @@ void ctbin::fill_cube(GCTAObservation* obs)
455 455 // Get the RoI
456 456 const GCTARoi& roi = events->roi();
457 457  
  458 + // Check for RoI sanity
  459 + if (!roi.is_valid()) {
  460 + std::string msg = "No RoI information found in input observation "
  461 + "\""+obs->name()+"\". Consider running ctselect "
  462 + "to set the RoI information properly. This is required "
  463 + "to proceed with ctbin.";
  464 + throw GException::invalid_value(G_FILL_CUBE, msg);
  465 + }
  466 +
458 467 // Initialise binning statistics
459 468 int num_outside_roi = 0;
460 469 int num_outside_map = 0;
... ...