Commit 7b30dbe3e95674381dfcd54377060a87072fcefc

Authored by Jürgen Knödlseder
1 parent bb439d90

Enable usage of Calibration parameter to specify a database and an instrument re…

…sponse function in the XML file.
inst/cta/src/GCTAObservation.cpp
... ... @@ -748,7 +748,8 @@ void GCTAObservation::read(const GXmlElement& xml)
748 748 (par->attribute("name") == "PSF") ||
749 749 (par->attribute("name") == "EnergyDispersion") ||
750 750 (par->attribute("name") == "RMF") ||
751   - (par->attribute("name") == "Background")) {
  751 + (par->attribute("name") == "Background") ||
  752 + (par->attribute("name") == "Calibration")) {
752 753 if (response_type == 2) {
753 754 throw GException::xml_invalid_parnames(G_READ, xml,
754 755 "Incompatible parameter names encountered in the "
... ...
inst/cta/src/GCTAResponseIrf.cpp
... ... @@ -583,19 +583,28 @@ void GCTAResponseIrf::read(const GXmlElement& xml)
583 583 if (par->attribute("name") == "Calibration") {
584 584  
585 585 // Read database and response
586   - m_xml_caldb = gammalib::strip_whitespace(par->attribute("database"));
587   - m_xml_rspname = gammalib::strip_whitespace(par->attribute("response"));
  586 + std::string xml_caldb = gammalib::strip_whitespace(par->attribute("database"));
  587 + std::string xml_rspname = gammalib::strip_whitespace(par->attribute("response"));
588 588  
589   - // Set response
  589 + // Set calibration database
590 590 GCaldb caldb;
591   - if (gammalib::dir_exists(m_xml_caldb)) {
592   - caldb.rootdir(m_xml_caldb);
  591 + if (gammalib::dir_exists(xml_caldb)) {
  592 + caldb.rootdir(xml_caldb);
593 593 }
594 594 else {
595   - caldb.open("cta", m_xml_caldb);
  595 + caldb.open("cta", xml_caldb);
596 596 }
597 597 this->caldb(caldb);
598   - load(m_xml_rspname);
  598 +
  599 + // Load response
  600 + this->load(xml_rspname);
  601 +
  602 + // Store database and response names (we do this now since the
  603 + // load() method results the object, except of the calibration
  604 + // database)
  605 + m_xml_caldb = xml_caldb;
  606 + m_xml_rspname = xml_rspname;
  607 +
599 608 }
600 609  
601 610 // Handle effective area
... ...