Commit 6265eb80c7457657e24d99525c834793bf4bc4e4

Authored by Jürgen Knödlseder
1 parent 7481317e

Invert caldb and response name argument in COMPTEL classes.

It seems more logical to start with the calibration database and then specify the response name in that calibration database.
... ... @@ -38,7 +38,8 @@ The following methods have been renamed:
38 38 - n.a.
39 39  
40 40 The arguments for the following methods have been changed:
41   -- n.a.
  41 +- GCOMResponse(GCaldb&, std::string&)
  42 +- GCOMObservation::response(GCaldb&, std::string&)
42 43  
43 44 The return value of the following methods has been changed:
44 45 - n.a.
... ...
inst/com/include/GCOMD1Response.hpp
... ... @@ -51,7 +51,7 @@ public:
51 51 // Constructors and destructors
52 52 GCOMD1Response(void);
53 53 GCOMD1Response(const GCOMD1Response& rsp);
54   - GCOMD1Response(const std::string& sdaname, const GCaldb& caldb);
  54 + GCOMD1Response(const GCaldb& caldb, const std::string& sdaname);
55 55 ~GCOMD1Response(void);
56 56  
57 57 // Operators
... ...
inst/com/include/GCOMD2Response.hpp
... ... @@ -51,7 +51,7 @@ public:
51 51 // Constructors and destructors
52 52 GCOMD2Response(void);
53 53 GCOMD2Response(const GCOMD2Response& rsp);
54   - GCOMD2Response(const std::string& sdbname, const GCaldb& caldb);
  54 + GCOMD2Response(const GCaldb& caldb, const std::string& sdbname);
55 55 ~GCOMD2Response(void);
56 56  
57 57 // Operators
... ...
inst/com/include/GCOMInstChars.hpp
... ... @@ -51,7 +51,7 @@ public:
51 51 // Constructors and destructors
52 52 GCOMInstChars(void);
53 53 GCOMInstChars(const GCOMInstChars& ict);
54   - GCOMInstChars(const std::string& ictname, const GCaldb& caldb);
  54 + GCOMInstChars(const GCaldb& caldb, const std::string& ictname);
55 55 ~GCOMInstChars(void);
56 56  
57 57 // Operators
... ...
inst/com/include/GCOMObservation.hpp
1 1 /***************************************************************************
2 2 * GCOMObservation.hpp - COMPTEL observation class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -89,7 +89,7 @@ public:
89 89 const GFilename& drbname,
90 90 const GFilename& drgname,
91 91 const GFilename& drxname);
92   - void response(const std::string& rspname, const GCaldb& caldb);
  92 + void response(const GCaldb& caldb, const std::string& rspname);
93 93 void obs_id(const double& id);
94 94 void ontime(const double& ontime);
95 95 void livetime(const double& livetime);
... ...
inst/com/include/GCOMResponse.hpp
1 1 /***************************************************************************
2 2 * GCOMResponse.hpp - COMPTEL Response class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -55,7 +55,10 @@ public:
55 55 // Constructors and destructors
56 56 GCOMResponse(void);
57 57 GCOMResponse(const GCOMResponse& rsp);
58   - GCOMResponse(const std::string& rspname, const GCaldb& caldb);
  58 + GCOMResponse(const GCaldb& caldb, const std::string& rspname);
  59 + //GCOMResponse(const int& phigeo_num, const int& phibar_num,
  60 + // const double& phigeo_max, const double& phibar_max,
  61 + // const double& phigeo_bin, const double& phibar_bin);
59 62 virtual ~GCOMResponse(void);
60 63  
61 64 // Operators
... ...
inst/com/pyext/GCOMD1Response.i
... ... @@ -40,7 +40,7 @@ public:
40 40 // Constructors and destructors
41 41 GCOMD1Response(void);
42 42 GCOMD1Response(const GCOMD1Response& rsp);
43   - GCOMD1Response(const std::string& sdaname, const GCaldb& caldb);
  43 + GCOMD1Response(const GCaldb& caldb, const std::string& sdaname);
44 44 ~GCOMD1Response(void);
45 45  
46 46 // Operators
... ...
inst/com/pyext/GCOMD2Response.i
... ... @@ -40,7 +40,7 @@ public:
40 40 // Constructors and destructors
41 41 GCOMD2Response(void);
42 42 GCOMD2Response(const GCOMD2Response& rsp);
43   - GCOMD2Response(const std::string& sdaname, const GCaldb& caldb);
  43 + GCOMD2Response(const GCaldb& caldb, const std::string& sdbname);
44 44 ~GCOMD2Response(void);
45 45  
46 46 // Operators
... ...
inst/com/pyext/GCOMInstChar.i
... ... @@ -40,7 +40,7 @@ public:
40 40 // Constructors and destructors
41 41 GCOMInstChars(void);
42 42 GCOMInstChars(const GCOMInstChars& ict);
43   - GCOMInstChars(const std::string& ictname, const GCaldb& caldb);
  43 + GCOMInstChars(const GCaldb& caldb, const std::string& ictname);
44 44 ~GCOMInstChars(void);
45 45  
46 46 // Methods
... ... @@ -50,7 +50,7 @@ public:
50 50 void caldb(const GCaldb& caldb);
51 51 const GCaldb& caldb(void) const;
52 52 void load(const std::string& ictname);
53   - double prob_D1inter(const GEnergy& energy, const double& zenith) const;
  53 + double prob_D1inter(const GEnergy& energy) const;
54 54 double prob_D2inter(const GEnergy& energy, const double& phigeo) const;
55 55 double prob_multihit(const GEnergy& energy) const;
56 56 double atten_D1(const GEnergy& energy) const;
... ...
inst/com/pyext/GCOMObservation.i
1 1 /***************************************************************************
2 2 * GCOMObservation.i - COMPTEL observation class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -63,7 +63,7 @@ public:
63 63 const GFilename& drbname,
64 64 const GFilename& drgname,
65 65 const GFilename& drxname);
66   - void response(const std::string& rspname, const GCaldb& caldb);
  66 + void response(const GCaldb& caldb, const std::string& rspname);
67 67 void obs_id(const double& id);
68 68 void ontime(const double& ontime);
69 69 void livetime(const double& livetime);
... ...
inst/com/pyext/GCOMResponse.i
1 1 /***************************************************************************
2 2 * GCOMResponse.i - COMPTEL Response class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,7 +39,7 @@ public:
39 39 // Constructors and destructors
40 40 GCOMResponse(void);
41 41 GCOMResponse(const GCOMResponse& rsp);
42   - GCOMResponse(const std::string& rspname, const GCaldb& caldb);
  42 + GCOMResponse(const GCaldb& caldb, const std::string& rspname);
43 43 virtual ~GCOMResponse(void);
44 44  
45 45 // Implement pure virtual base class methods
... ...
inst/com/src/GCOMD1Response.cpp
... ... @@ -84,13 +84,13 @@ GCOMD1Response::GCOMD1Response(const GCOMD1Response& rsp)
84 84 /***********************************************************************//**
85 85 * @brief Response constructor
86 86 *
87   - * @param[in] sdaname SDA response name.
88 87 * @param[in] caldb Calibration database.
  88 + * @param[in] sdaname SDA response name.
89 89 *
90 90 * Create COMPTEL D1 module response by loading an SDA file from a
91 91 * calibration database.
92 92 ***************************************************************************/
93   -GCOMD1Response::GCOMD1Response(const std::string& sdaname, const GCaldb& caldb)
  93 +GCOMD1Response::GCOMD1Response(const GCaldb& caldb, const std::string& sdaname)
94 94 {
95 95 // Initialise members
96 96 init_members();
... ...
inst/com/src/GCOMD2Response.cpp
... ... @@ -84,13 +84,13 @@ GCOMD2Response::GCOMD2Response(const GCOMD2Response& rsp)
84 84 /***********************************************************************//**
85 85 * @brief Response constructor
86 86 *
87   - * @param[in] sdbname SDA response name.
88 87 * @param[in] caldb Calibration database.
  88 + * @param[in] sdbname SDA response name.
89 89 *
90 90 * Create COMPTEL D2 module response by loading an SDB file from a
91 91 * calibration database.
92 92 ***************************************************************************/
93   -GCOMD2Response::GCOMD2Response(const std::string& sdbname, const GCaldb& caldb)
  93 +GCOMD2Response::GCOMD2Response(const GCaldb& caldb, const std::string& sdbname)
94 94 {
95 95 // Initialise members
96 96 init_members();
... ...
inst/com/src/GCOMInstChars.cpp
... ... @@ -88,13 +88,13 @@ GCOMInstChars::GCOMInstChars(const GCOMInstChars& ict)
88 88 /***********************************************************************//**
89 89 * @brief Response constructor
90 90 *
91   - * @param[in] ictname ICT response name.
92 91 * @param[in] caldb Calibration database.
  92 + * @param[in] ictname ICT response name.
93 93 *
94 94 * Create COMPTEL instrument characteristics by loading an SDA file from a
95 95 * calibration database.
96 96 ***************************************************************************/
97   -GCOMInstChars::GCOMInstChars(const std::string& ictname, const GCaldb& caldb)
  97 +GCOMInstChars::GCOMInstChars(const GCaldb& caldb, const std::string& ictname)
98 98 {
99 99 // Initialise members
100 100 init_members();
... ...
inst/com/src/GCOMObservation.cpp
1 1 /***************************************************************************
2 2 * GCOMObservation.cpp - COMPTEL Observation class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -249,13 +249,13 @@ void GCOMObservation::response(const GResponse& rsp)
249 249 /***********************************************************************//**
250 250 * @brief Set response function
251 251 *
252   - * @param[in] rspname Name of COMPTEL response.
253 252 * @param[in] caldb Calibration database.
  253 + * @param[in] rspname Name of COMPTEL response.
254 254 *
255 255 * Sets the response function by loading the response information from the
256 256 * calibration database.
257 257 ***************************************************************************/
258   -void GCOMObservation::response(const std::string& rspname, const GCaldb& caldb)
  258 +void GCOMObservation::response(const GCaldb& caldb, const std::string& rspname)
259 259 {
260 260 // Clear COM response function
261 261 m_response.clear();
... ... @@ -323,7 +323,7 @@ void GCOMObservation::read(const GXmlElement& xml)
323 323 load(drename, drbname, drgname, drxname);
324 324  
325 325 // Load IAQ
326   - response(iaqname, GCaldb("cgro", "comptel"));
  326 + response(GCaldb("cgro", "comptel"), iaqname);
327 327  
328 328 // Return
329 329 return;
... ...
inst/com/src/GCOMResponse.cpp
1 1 /***************************************************************************
2 2 * GCOMResponse.cpp - COMPTEL Response class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -105,14 +105,14 @@ GCOMResponse::GCOMResponse(const GCOMResponse& rsp) : GResponse(rsp)
105 105 /***********************************************************************//**
106 106 * @brief Response constructor
107 107 *
108   - * @param[in] iaqname IAQ file name.
109 108 * @param[in] caldb Calibration database.
  109 + * @param[in] iaqname IAQ file name.
110 110 *
111 111 * Create COMPTEL response by loading an IAQ file from a calibration
112 112 * database.
113 113 ***************************************************************************/
114   -GCOMResponse::GCOMResponse(const std::string& iaqname,
115   - const GCaldb& caldb) : GResponse()
  114 +GCOMResponse::GCOMResponse(const GCaldb& caldb,
  115 + const std::string& iaqname) : GResponse()
116 116 {
117 117 // Initialise members
118 118 init_members();
... ...
inst/com/test/test_COM.cpp
1 1 /***************************************************************************
2 2 * test_COM.cpp - test COM classes *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -238,7 +238,7 @@ void TestGCOMResponse::test_response(void)
238 238 test_try("Test response loading");
239 239 try {
240 240 // Construct response from datasets
241   - GCOMResponse rsp(com_iaq, GCaldb("cgro", "comptel"));
  241 + GCOMResponse rsp(GCaldb("cgro", "comptel"), com_iaq);
242 242  
243 243 // If we arrived here, signal success
244 244 test_try_success();
... ... @@ -585,7 +585,7 @@ void TestGCOMOptimize::test_binned_optimizer(void)
585 585 test_try("Load binned COMPTEL observation");
586 586 try {
587 587 run.load(com_dre, com_drb, com_drg, com_drx);
588   - run.response(com_iaq, GCaldb("cgro", "comptel"));
  588 + run.response(GCaldb("cgro", "comptel"), com_iaq);
589 589 obs.append(run);
590 590 test_try_success();
591 591 }
... ...