lsst.afw  13.0-73-gb2a4e38
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CameraSys.h
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2014 LSST Corporation.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <http://www.lsstcorp.org/LegalNotices/>.
21  */
22 
23 #if !defined(LSST_AFW_CAMERAGEOM_CAMERASYS_H)
24 #define LSST_AFW_CAMERAGEOM_CAMERASYS_H
25 
26 #include <functional>
27 #include <string>
28 #include <ostream>
29 #include <sstream>
32 
33 namespace lsst {
34 namespace afw {
35 namespace cameraGeom {
36 
47 public:
48  explicit CameraSysPrefix(std::string const &sysName
49  )
50  : _sysName(sysName) {}
51 
55  std::string getSysName() const { return _sysName; };
56 
57  bool operator==(CameraSysPrefix const &rhs) const { return _sysName == rhs.getSysName(); }
58 
59  bool operator!=(CameraSysPrefix const &rhs) const { return !(*this == rhs); }
60 
61 private:
62  std::string _sysName;
63 };
64 
74 class CameraSys {
75 public:
79  explicit CameraSys(std::string const &sysName,
80  std::string const &detectorName = ""
81  )
82  : _sysName(sysName), _detectorName(detectorName){};
83 
87  explicit CameraSys(CameraSysPrefix const &sysPrefix,
88  std::string const &detectorName = ""
89  )
90  : _sysName(sysPrefix.getSysName()), _detectorName(detectorName){};
91 
93  CameraSys() : _sysName("?"), _detectorName(){};
94 
98  std::string getSysName() const { return _sysName; };
99 
103  std::string getDetectorName() const { return _detectorName; };
104 
108  bool hasDetectorName() const { return !_detectorName.empty(); }
109 
110  bool operator==(CameraSys const &rhs) const {
111  return _sysName == rhs.getSysName() && _detectorName == rhs.getDetectorName();
112  }
113 
114  bool operator!=(CameraSys const &rhs) const { return !(*this == rhs); }
115 
116  // less-than operator required for use in std::map
117  bool operator<(CameraSys const &rhs) const {
118  if (_sysName == rhs.getSysName()) {
119  return _detectorName < rhs.getDetectorName();
120  } else {
121  return _sysName < rhs.getSysName();
122  }
123  }
124 
125 private:
126  std::string _sysName;
127  std::string _detectorName;
128 };
129 
130 // CameraSys is intended as a key for geom::TransformMap, so define this useful type
132 
133 // *** Standard camera coordinate systems ***
134 
140 extern CameraSys const FOCAL_PLANE;
141 
146 extern CameraSys const PUPIL;
147 
155 extern CameraSysPrefix const PIXELS;
156 
172 extern CameraSysPrefix const TAN_PIXELS;
173 
180 extern CameraSysPrefix const ACTUAL_PIXELS;
181 
182 std::ostream &operator<<(std::ostream &os, CameraSysPrefix const &detSysPrefix);
183 
184 std::ostream &operator<<(std::ostream &os, CameraSys const &cameraSys);
185 }
186 }
187 }
188 
189 #endif
Camera coordinate system; used as a key in in TransformMap.
Definition: CameraSys.h:74
CameraSysPrefix const PIXELS
Nominal pixels on the detector (unbinned) This ignores manufacturing imperfections, &quot;tree ring&quot; distortions and all other such effects.
Definition: CameraSys.cc:33
bool operator==(CameraSys const &rhs) const
Definition: CameraSys.h:110
bool operator<(CameraSys const &rhs) const
Definition: CameraSys.h:117
std::string getDetectorName() const
Get detector name, or &quot;&quot; if not a detector-specific coordinate system.
Definition: CameraSys.h:103
std::ostream & operator<<(std::ostream &os, CameraPoint const &cameraPoint)
Definition: CameraPoint.cc:29
bool operator!=(CameraSys const &rhs) const
Definition: CameraSys.h:114
CameraSys const PUPIL
Pupil coordinates: Angular x,y offset from the vertex at the pupil (radians).
Definition: CameraSys.cc:31
CameraSysPrefix const ACTUAL_PIXELS
The actual pixels where the photon lands and electrons are generated (unbinned) This takes into accou...
Definition: CameraSys.cc:37
CameraSys(std::string const &sysName, std::string const &detectorName="")
Construct a CameraSys from a sysName and a detectorName.
Definition: CameraSys.h:79
CameraSys()
default constructor so SWIG can wrap a vector of pairs containing these
Definition: CameraSys.h:93
geom::TransformMap< CameraSys > CameraTransformMap
Definition: CameraSys.h:131
Camera coordinate system prefix.
Definition: CameraSys.h:46
CameraSys(CameraSysPrefix const &sysPrefix, std::string const &detectorName="")
Construct a CameraSys from a CameraSysPrefix and a detectorName.
Definition: CameraSys.h:87
CameraSysPrefix(std::string const &sysName)
Definition: CameraSys.h:48
CameraSysPrefix const TAN_PIXELS
Tangent-plane pixels on the detector (unbinned)
Definition: CameraSys.cc:35
bool hasDetectorName() const
Does this have a non-blank detector name?
Definition: CameraSys.h:108
bool operator!=(CameraSysPrefix const &rhs) const
Definition: CameraSys.h:59
CameraSys const FOCAL_PLANE
Focal plane coordinates: Rectilinear x, y (and z when talking about the location of a detector) on th...
Definition: CameraSys.cc:29
bool operator==(CameraSysPrefix const &rhs) const
Definition: CameraSys.h:57
std::string getSysName() const
Get coordinate system name.
Definition: CameraSys.h:98
std::string getSysName() const
Get coordinate system name.
Definition: CameraSys.h:55