Commit c81a8bdbffbafeb24345eb19c1b7746893a93736

Authored by Jürgen Knödlseder
1 parent b747ad54

Use XML element to set the response function. This will then lead to writing of …

…response information in the XML observation definition file (when needed).
Showing 1 changed file with 19 additions and 1 deletions
src/support/ctool.cpp
@@ -762,9 +762,26 @@ void ctool::set_obs_response(GCTAObservation* obs) @@ -762,9 +762,26 @@ void ctool::set_obs_response(GCTAObservation* obs)
762 std::string database = (*this)["caldb"].string(); 762 std::string database = (*this)["caldb"].string();
763 std::string irf = (*this)["irf"].string(); 763 std::string irf = (*this)["irf"].string();
764 764
  765 + // Create an XML element containing the database and IRF name. This
  766 + // kluge will make sure that the information is later written
  767 + // to the observation definition XML file, in case an observation
  768 + // definition XML file is written.
  769 + std::string parameter = "parameter name=\"Calibration\""
  770 + " database=\""+database+"\""
  771 + " response=\""+irf+"\"";
  772 + GXmlElement xml;
  773 + xml.append(parameter);
  774 +
  775 + // Create CTA response
  776 + GCTAResponseIrf response(xml);
  777 +
  778 + // Attach response to observation
  779 + obs->response(response);
  780 +
765 // Set calibration database. If "database" is a valid directory then use 781 // Set calibration database. If "database" is a valid directory then use
766 // this as the pathname to the calibration database. Otherwise, interpret 782 // this as the pathname to the calibration database. Otherwise, interpret
767 // "database" as the instrument name, the mission being "cta" 783 // "database" as the instrument name, the mission being "cta"
  784 + /*
768 GCaldb caldb; 785 GCaldb caldb;
769 if (gammalib::dir_exists(database)) { 786 if (gammalib::dir_exists(database)) {
770 caldb.rootdir(database); 787 caldb.rootdir(database);
@@ -772,9 +789,10 @@ void ctool::set_obs_response(GCTAObservation* obs) @@ -772,9 +789,10 @@ void ctool::set_obs_response(GCTAObservation* obs)
772 else { 789 else {
773 caldb.open("cta", database); 790 caldb.open("cta", database);
774 } 791 }
  792 + */
775 793
776 // Set reponse 794 // Set reponse
777 - obs->response(irf, caldb); 795 + //obs->response(irf, caldb);
778 796
779 // Signal response availability 797 // Signal response availability
780 has_response = true; 798 has_response = true;