LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
Detector.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_DETECTOR_H)
24 #define LSST_AFW_CAMERAGEOM_DETECTOR_H
25 
26 #include <string>
27 #include <vector>
28 #include <unordered_map>
29 #include "lsst/base.h"
31 #include "lsst/afw/table/AmpInfo.h"
35 
36 namespace lsst {
37 namespace afw {
38 namespace cameraGeom {
39 
48 };
49 
50 
65 class Detector {
66 public:
78  explicit Detector(
79  std::string const &name,
80  int id,
81  DetectorType type,
82  std::string const &serial,
83  geom::Box2I const &bbox,
84  lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog,
85  Orientation const &orientation,
86  geom::Extent2D const &pixelSize,
87  CameraTransformMap::Transforms const &transforms
88  );
91 
92  ~Detector() {}
93 
95  std::string getName() const { return _name; }
96 
98  int getId() const { return _id; }
99 
100  DetectorType getType() const { return _type; }
101 
103  std::string getSerial() const { return _serial; }
104 
107 
109  std::vector<geom::Point2D> getCorners(CameraSys const &cameraSys) const;
110 
112  std::vector<geom::Point2D> getCorners(CameraSysPrefix const &cameraSysPrefix) const;
113 
115  CameraPoint getCenter(CameraSys const &cameraSys) const;
116 
118  CameraPoint getCenter(CameraSysPrefix const &cameraSysPrefix) const;
119 
122 
124  Orientation const getOrientation() const { return _orientation; }
125 
128 
131 
134 
137 
143  lsst::afw::table::AmpInfoRecord const & operator[](size_t i) const { return _ampInfoCatalog.at(i); }
144 
150  lsst::afw::table::AmpInfoRecord const & operator[](std::string const &name) const;
151 
155  size_t size() const {return _ampInfoCatalog.size(); }
156 
158  bool hasTransform(CameraSys const &cameraSys) const;
159 
161  bool hasTransform(CameraSysPrefix const &cameraSysPrefix) const;
162 
171  CONST_PTR(afw::geom::XYTransform) getTransform(CameraSys const &cameraSys) const;
172 
181  CONST_PTR(afw::geom::XYTransform) getTransform(CameraSysPrefix const &cameraSysPrefix) const;
182 
189  geom::Point2D point,
190  CameraSys cameraSys
191  ) const {
192  return CameraPoint(point, cameraSys);
193  }
194 
199  geom::Point2D point,
200  CameraSysPrefix cameraSysPrefix
201  ) const {
202  return CameraPoint(point, makeCameraSys(cameraSysPrefix));
203  }
204 
210  CameraSys const makeCameraSys(CameraSys const &cameraSys) const { return cameraSys; }
211 
215  CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const {
216  return CameraSys(cameraSysPrefix.getSysName(), _name);
217  }
218 
225  CameraPoint const &fromCameraPoint,
226  CameraSys const &toSys
227  ) const {
228  return CameraPoint(
229  _transformMap.transform(fromCameraPoint.getPoint(), fromCameraPoint.getCameraSys(), toSys),
230  toSys);
231  }
232 
241  CameraPoint const &fromCameraPoint,
242  CameraSysPrefix const &toSys
243  ) const {
244  return transform(fromCameraPoint, makeCameraSys(toSys));
245  }
246 
247 private:
248  typedef std::unordered_map<std::string, table::AmpInfoCatalog::const_iterator> _AmpInfoMap;
259  void _init();
260 
261  std::string _name;
262  int _id;
264  std::string _serial;
271 };
272 
273 }}}
274 
275 #endif
std::string getName() const
Get the detector name.
Definition: Detector.h:95
Camera coordinate system; used as a key in in TransformMap.
Definition: CameraSys.h:77
geom::Extent2D _pixelSize
pixel size (mm)
Definition: Detector.h:269
table::Key< std::string > name
Definition: ApCorrMap.cc:71
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:266
Geometry and electronic information about raw amplifier images.
Definition: AmpInfo.h:77
Describe a Detector&#39;s orientation.
lsst::afw::table::AmpInfoCatalog::const_iterator begin() const
Get iterator to beginning of amplifier list.
Definition: Detector.h:133
CameraTransformMap const getTransformMap() const
Get the transform registry.
Definition: Detector.h:130
CameraPoint makeCameraPoint(geom::Point2D point, CameraSysPrefix cameraSysPrefix) const
Make a CameraPoint from a point and a camera system prefix.
Definition: Detector.h:198
A custom container class for records, based on std::vector.
Definition: Catalog.h:95
CameraSys getCameraSys() const
Definition: CameraPoint.h:41
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:270
std::map< CameraSys, boost::shared_ptr< XYTransform const > > Transforms
Definition: TransformMap.h:67
void _init()
Finish constructing this object.
Definition: Detector.cc:101
std::string _serial
serial &quot;number&quot; that identifies the physical detector
Definition: Detector.h:264
CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const
Get a coordinate system from a detector system prefix (add detector name)
Definition: Detector.h:215
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:402
CameraPoint makeCameraPoint(geom::Point2D point, CameraSys cameraSys) const
Make a CameraPoint from a point and a camera system.
Definition: Detector.h:188
Orientation _orientation
position and orientation of detector in focal plane
Definition: Detector.h:268
DetectorType _type
type of detectorsize_t
Definition: Detector.h:263
Point2D transform(Point2D const &fromPoint, CoordSysT const &fromSys, CoordSysT const &toCoordSys) const
Convert a point from one coordinate system to another.
std::vector< geom::Point2D > getCorners(CameraSys const &cameraSys) const
Get the corners of the detector in the specified coordinate system.
Definition: Detector.cc:56
An integer coordinate rectangle.
Definition: Box.h:53
boost::shared_ptr< afw::geom::XYTransform const > getTransform(CameraSys const &cameraSys) const
Get an XYTransform that transforms from cameraSys to the native system in the forward direction...
Definition: Detector.cc:92
Describe a detector&#39;s orientation in the focal plane.
Definition: Orientation.h:53
std::string _name
name of detector&#39;s location in the camera
Definition: Detector.h:261
bool hasTransform(CameraSys const &cameraSys) const
Does the specified CameraSys exist in the transform registry.
Definition: Detector.cc:84
iterator begin()
Iterator access.
Definition: Catalog.h:392
size_t size() const
Get number of amplifiers.
Definition: Detector.h:155
_AmpInfoMap _ampNameIterMap
map of amplifier name: catalog iterator
Definition: Detector.h:267
std::unordered_map< std::string, table::AmpInfoCatalog::const_iterator > _AmpInfoMap
Definition: Detector.h:248
lsst::afw::table::AmpInfoRecord const & operator[](size_t i) const
Get the amplifier specified by index.
Definition: Detector.h:143
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Get a coordinate system from a coordinate system (return input unchanged and untested) ...
Definition: Detector.h:210
Iterator class for CatalogT.
Definition: Catalog.h:35
lsst::afw::geom::Box2I getBBox() const
Get the bounding box.
Definition: Detector.h:106
geom::Box2I _bbox
bounding box
Definition: Detector.h:265
DetectorType getType() const
Definition: Detector.h:100
std::string getSerial() const
Get the detector serial &quot;number&quot;.
Definition: Detector.h:103
Camera coordinate system prefix.
Definition: CameraSys.h:46
lsst::afw::table::AmpInfoCatalog const getAmpInfoCatalog() const
Get the amplifier information catalog.
Definition: Detector.h:121
int _id
detector numeric ID
Definition: Detector.h:262
std::string getSysName() const
Get coordinate system name.
Definition: CameraSys.h:55
Information about a CCD or other imaging detector.
Definition: Detector.h:65
iterator end()
Iterator access.
Definition: Catalog.h:393
Virtual base class for 2D transforms.
Definition: XYTransform.h:48
geom::Extent2D getPixelSize() const
Get size of pixel along (mm)
Definition: Detector.h:127
Detector(std::string const &name, int id, DetectorType type, std::string const &serial, geom::Box2I const &bbox, lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog, Orientation const &orientation, geom::Extent2D const &pixelSize, CameraTransformMap::Transforms const &transforms)
Make a Detector.
Definition: Detector.cc:31
reference at(size_type i) const
Return the record at index i (throws std::out_of_range).
Definition: Catalog.h:431
A Point2D with associated camera coordinate system.
Definition: CameraPoint.h:37
Point< double, 2 > Point2D
Definition: Point.h:288
Orientation const getOrientation() const
Get detector&#39;s orientation in the focal plane.
Definition: Detector.h:124
CameraPoint getCenter(CameraSys const &cameraSys) const
Get the center of the detector in the specified coordinate system.
Definition: Detector.cc:65
#define CONST_PTR(...)
A shared pointer to a const object.
Definition: base.h:47
Basic LSST definitions.
DetectorType
Type of imaging detector.
Definition: Detector.h:43
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSysPrefix const &toSys) const
Convert a CameraPoint from one coordinate system to a coordinate system prefix.
Definition: Detector.h:240
lsst::afw::table::AmpInfoCatalog::const_iterator end() const
Get iterator to end of amplifier list.
Definition: Detector.h:136
geom::Point2D getPoint() const
Definition: CameraPoint.h:40
int getId() const
Get the detector ID.
Definition: Detector.h:98
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
Convert a CameraPoint from one coordinate system to another.
Definition: Detector.h:224