Commit d95c652ef817bfb7091a941f350d75c975307dee
1 parent
41fcf69c
GCaldb::filename() now returns GFilename (#1745)
Showing
8 changed files
with
60 additions
and
57 deletions
ChangeLog
NEWS
| ... | ... | @@ -109,6 +109,7 @@ of std::string: |
| 109 | 109 | The return value has been changed for the following methods: |
| 110 | 110 | - GFits::filename() returns now GFilename instead of std::string |
| 111 | 111 | - GCTAObservation::eventtype() returns now std::string instead of const std::string& |
| 112 | +- GCaldb::filename() returns now GFilename instead of std::string | |
| 112 | 113 | |
| 113 | 114 | The interface for the following methods has been changed: |
| 114 | 115 | - GFitsImage naxes constructor | ... | ... |
include/GCaldb.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCaldb.hpp - Calibration database class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -32,6 +32,7 @@ |
| 32 | 32 | #include "GBase.hpp" |
| 33 | 33 | #include "GFits.hpp" |
| 34 | 34 | #include "GFitsTable.hpp" |
| 35 | +#include "GFilename.hpp" | |
| 35 | 36 | |
| 36 | 37 | |
| 37 | 38 | /***********************************************************************//** |
| ... | ... | @@ -89,7 +90,7 @@ public: |
| 89 | 90 | void open(const std::string& mission, |
| 90 | 91 | const std::string& instrument = ""); |
| 91 | 92 | void close(void); |
| 92 | - std::string filename(const std::string& detector, | |
| 93 | + GFilename filename(const std::string& detector, | |
| 93 | 94 | const std::string& filter, |
| 94 | 95 | const std::string& codename, |
| 95 | 96 | const std::string& date, | ... | ... |
inst/cta/include/GCTAResponseIrf.hpp
| ... | ... | @@ -160,46 +160,46 @@ public: |
| 160 | 160 | |
| 161 | 161 | private: |
| 162 | 162 | // Private methods |
| 163 | - void init_members(void); | |
| 164 | - void copy_members(const GCTAResponseIrf& rsp); | |
| 165 | - void free_members(void); | |
| 166 | - std::string irf_filename(const std::string& filename) const; | |
| 167 | - double irf_ptsrc(const GEvent& event, | |
| 163 | + void init_members(void); | |
| 164 | + void copy_members(const GCTAResponseIrf& rsp); | |
| 165 | + void free_members(void); | |
| 166 | + GFilename irf_filename(const std::string& filename) const; | |
| 167 | + double irf_ptsrc(const GEvent& event, | |
| 168 | + const GSource& source, | |
| 169 | + const GObservation& obs) const; | |
| 170 | + double irf_radial(const GEvent& event, | |
| 171 | + const GSource& source, | |
| 172 | + const GObservation& obs) const; | |
| 173 | + double irf_elliptical(const GEvent& event, | |
| 174 | + const GSource& source, | |
| 175 | + const GObservation& obs) const; | |
| 176 | + double irf_diffuse(const GEvent& event, | |
| 168 | 177 | const GSource& source, |
| 169 | 178 | const GObservation& obs) const; |
| 170 | - double irf_radial(const GEvent& event, | |
| 171 | - const GSource& source, | |
| 172 | - const GObservation& obs) const; | |
| 173 | - double irf_elliptical(const GEvent& event, | |
| 174 | - const GSource& source, | |
| 175 | - const GObservation& obs) const; | |
| 176 | - double irf_diffuse(const GEvent& event, | |
| 177 | - const GSource& source, | |
| 178 | - const GObservation& obs) const; | |
| 179 | - double nroi_ptsrc(const GModelSky& model, | |
| 179 | + double nroi_ptsrc(const GModelSky& model, | |
| 180 | + const GEnergy& srcEng, | |
| 181 | + const GTime& srcTime, | |
| 182 | + const GEnergy& obsEng, | |
| 183 | + const GTime& obsTime, | |
| 184 | + const GObservation& obs) const; | |
| 185 | + double nroi_radial(const GModelSky& model, | |
| 186 | + const GEnergy& srcEng, | |
| 187 | + const GTime& srcTime, | |
| 188 | + const GEnergy& obsEng, | |
| 189 | + const GTime& obsTime, | |
| 190 | + const GObservation& obs) const; | |
| 191 | + double nroi_elliptical(const GModelSky& model, | |
| 192 | + const GEnergy& srcEng, | |
| 193 | + const GTime& srcTime, | |
| 194 | + const GEnergy& obsEng, | |
| 195 | + const GTime& obsTime, | |
| 196 | + const GObservation& obs) const; | |
| 197 | + double nroi_diffuse(const GModelSky& model, | |
| 180 | 198 | const GEnergy& srcEng, |
| 181 | 199 | const GTime& srcTime, |
| 182 | 200 | const GEnergy& obsEng, |
| 183 | 201 | const GTime& obsTime, |
| 184 | 202 | const GObservation& obs) const; |
| 185 | - double nroi_radial(const GModelSky& model, | |
| 186 | - const GEnergy& srcEng, | |
| 187 | - const GTime& srcTime, | |
| 188 | - const GEnergy& obsEng, | |
| 189 | - const GTime& obsTime, | |
| 190 | - const GObservation& obs) const; | |
| 191 | - double nroi_elliptical(const GModelSky& model, | |
| 192 | - const GEnergy& srcEng, | |
| 193 | - const GTime& srcTime, | |
| 194 | - const GEnergy& obsEng, | |
| 195 | - const GTime& obsTime, | |
| 196 | - const GObservation& obs) const; | |
| 197 | - double nroi_diffuse(const GModelSky& model, | |
| 198 | - const GEnergy& srcEng, | |
| 199 | - const GTime& srcTime, | |
| 200 | - const GEnergy& obsEng, | |
| 201 | - const GTime& obsTime, | |
| 202 | - const GObservation& obs) const; | |
| 203 | 203 | |
| 204 | 204 | // Private data members |
| 205 | 205 | GCaldb m_caldb; //!< Calibration database | ... | ... |
inst/cta/src/GCTAResponseIrf.cpp
| ... | ... | @@ -1021,23 +1021,23 @@ void GCTAResponseIrf::load(const std::string& rspname) |
| 1021 | 1021 | |
| 1022 | 1022 | // First attempt reading the response using the GCaldb interface |
| 1023 | 1023 | std::string expr = "NAME("+rspname+")"; |
| 1024 | - std::string aeffname = m_caldb.filename("","","EFF_AREA","","",expr); | |
| 1025 | - std::string psfname = m_caldb.filename("","","RPSF","","",expr); | |
| 1026 | - std::string edispname = m_caldb.filename("","","EDISP","","",expr); | |
| 1027 | - std::string bgdname = m_caldb.filename("","","BGD","","",expr); | |
| 1024 | + GFilename aeffname = m_caldb.filename("","","EFF_AREA","","",expr); | |
| 1025 | + GFilename psfname = m_caldb.filename("","","RPSF","","",expr); | |
| 1026 | + GFilename edispname = m_caldb.filename("","","EDISP","","",expr); | |
| 1027 | + GFilename bgdname = m_caldb.filename("","","BGD","","",expr); | |
| 1028 | 1028 | |
| 1029 | 1029 | // If filenames are empty then build filenames from CALDB root path and |
| 1030 | 1030 | // response name |
| 1031 | - if (aeffname.length() < 1) { | |
| 1031 | + if (aeffname.is_empty()) { | |
| 1032 | 1032 | aeffname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); |
| 1033 | 1033 | } |
| 1034 | - if (psfname.length() < 1) { | |
| 1034 | + if (psfname.is_empty()) { | |
| 1035 | 1035 | psfname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); |
| 1036 | 1036 | } |
| 1037 | - if (edispname.length() < 1) { | |
| 1037 | + if (edispname.is_empty()) { | |
| 1038 | 1038 | edispname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); |
| 1039 | 1039 | } |
| 1040 | - if (bgdname.length() < 1) { | |
| 1040 | + if (bgdname.is_empty()) { | |
| 1041 | 1041 | bgdname = irf_filename(gammalib::filepath(m_caldb.rootdir(), rspname)); |
| 1042 | 1042 | } |
| 1043 | 1043 | |
| ... | ... | @@ -2185,7 +2185,7 @@ void GCTAResponseIrf::free_members(void) |
| 2185 | 2185 | * file with the added suffix .dat exists. Returns the file name with the |
| 2186 | 2186 | * appropriate extension. |
| 2187 | 2187 | ***************************************************************************/ |
| 2188 | -std::string GCTAResponseIrf::irf_filename(const std::string& filename) const | |
| 2188 | +GFilename GCTAResponseIrf::irf_filename(const std::string& filename) const | |
| 2189 | 2189 | { |
| 2190 | 2190 | // Set input filename as result filename |
| 2191 | 2191 | GFilename result = filename; |
| ... | ... | @@ -2199,7 +2199,7 @@ std::string GCTAResponseIrf::irf_filename(const std::string& filename) const |
| 2199 | 2199 | } |
| 2200 | 2200 | |
| 2201 | 2201 | // Return result |
| 2202 | - return (result.url()); | |
| 2202 | + return result; | |
| 2203 | 2203 | } |
| 2204 | 2204 | |
| 2205 | 2205 | ... | ... |
inst/lat/src/GLATResponse.cpp
| ... | ... | @@ -626,9 +626,9 @@ void GLATResponse::load(const std::string& rspname) |
| 626 | 626 | |
| 627 | 627 | // Get response using the GCaldb interface |
| 628 | 628 | std::string expr = "VERSION("+gammalib::toupper(m_rspname)+")"; |
| 629 | - std::string aeffname = caldb.filename(type_names[i],"","EFF_AREA","","",expr); | |
| 630 | - std::string psfname = caldb.filename(type_names[i],"","RPSF","","",expr); | |
| 631 | - std::string edispname = caldb.filename(type_names[i],"","EDISP","","",expr); | |
| 629 | + GFilename aeffname = caldb.filename(type_names[i],"","EFF_AREA","","",expr); | |
| 630 | + GFilename psfname = caldb.filename(type_names[i],"","RPSF","","",expr); | |
| 631 | + GFilename edispname = caldb.filename(type_names[i],"","EDISP","","",expr); | |
| 632 | 632 | |
| 633 | 633 | // Load IRF components |
| 634 | 634 | GLATAeff* aeff = new GLATAeff(aeffname, type_names[i]); | ... | ... |
pyext/GCaldb.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCaldb.i - Calibration database class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -57,7 +57,7 @@ public: |
| 57 | 57 | void open(const std::string& mission, |
| 58 | 58 | const std::string& instrument = ""); |
| 59 | 59 | void close(void); |
| 60 | - std::string filename(const std::string& detector, | |
| 60 | + GFilename filename(const std::string& detector, | |
| 61 | 61 | const std::string& filter, |
| 62 | 62 | const std::string& codename, |
| 63 | 63 | const std::string& date, | ... | ... |
src/obs/GCaldb.cpp
| ... | ... | @@ -504,15 +504,15 @@ void GCaldb::close(void) |
| 504 | 504 | * @todo time should support "now" and probably be implemented using < condition. |
| 505 | 505 | * @todo expr should support arbitrary Boolean expressions. |
| 506 | 506 | ***************************************************************************/ |
| 507 | -std::string GCaldb::filename(const std::string& detector, | |
| 508 | - const std::string& filter, | |
| 509 | - const std::string& codename, | |
| 510 | - const std::string& date, | |
| 511 | - const std::string& time, | |
| 512 | - const std::string& expr) | |
| 507 | +GFilename GCaldb::filename(const std::string& detector, | |
| 508 | + const std::string& filter, | |
| 509 | + const std::string& codename, | |
| 510 | + const std::string& date, | |
| 511 | + const std::string& time, | |
| 512 | + const std::string& expr) | |
| 513 | 513 | { |
| 514 | 514 | // Initialise empty filename |
| 515 | - std::string filename; | |
| 515 | + GFilename filename; | |
| 516 | 516 | |
| 517 | 517 | // Continue only if CIF is opened |
| 518 | 518 | if (m_cif != NULL) { | ... | ... |