LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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 "lsst/base.h"
30 #include "lsst/afw/table/AmpInfo.h"
34 
35 namespace lsst {
36 namespace afw {
37 namespace cameraGeom {
38 
47 };
48 
49 
64 class Detector {
65 public:
77  explicit Detector(
78  std::string const &name,
79  int id,
80  DetectorType type,
81  std::string const &serial,
82  geom::Box2I const &bbox,
83  lsst::afw::table::AmpInfoCatalog const &ampInfoCatalog,
84  Orientation const &orientation,
85  geom::Extent2D const &pixelSize,
86  CameraTransformMap::Transforms const &transforms
87  );
90 
91  ~Detector() {}
92 
94  std::string getName() const { return _name; }
95 
97  int getId() const { return _id; }
98 
99  DetectorType getType() const { return _type; }
100 
102  std::string getSerial() const { return _serial; }
103 
106 
108  std::vector<geom::Point2D> getCorners(CameraSys const &cameraSys) const;
109 
111  std::vector<geom::Point2D> getCorners(CameraSysPrefix const &cameraSysPrefix) const;
112 
114  CameraPoint getCenter(CameraSys const &cameraSys) const;
115 
117  CameraPoint getCenter(CameraSysPrefix const &cameraSysPrefix) const;
118 
121 
123  Orientation const getOrientation() const { return _orientation; }
124 
127 
130 
133 
136 
142  lsst::afw::table::AmpInfoRecord const & operator[](size_t i) const { return _ampInfoCatalog.at(i); }
143 
149  lsst::afw::table::AmpInfoRecord const & operator[](std::string const &name) const;
150 
154  size_t size() const {return _ampInfoCatalog.size(); }
155 
157  bool hasTransform(CameraSys const &cameraSys) const;
158 
160  bool hasTransform(CameraSysPrefix const &cameraSysPrefix) const;
161 
170  CONST_PTR(afw::geom::XYTransform) getTransform(CameraSys const &cameraSys) const;
171 
180  CONST_PTR(afw::geom::XYTransform) getTransform(CameraSysPrefix const &cameraSysPrefix) const;
181 
188  geom::Point2D point,
189  CameraSys cameraSys
190  ) const {
191  return CameraPoint(point, cameraSys);
192  }
193 
198  geom::Point2D point,
199  CameraSysPrefix cameraSysPrefix
200  ) const {
201  return CameraPoint(point, makeCameraSys(cameraSysPrefix));
202  }
203 
209  CameraSys const makeCameraSys(CameraSys const &cameraSys) const { return cameraSys; }
210 
214  CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const {
215  return CameraSys(cameraSysPrefix.getSysName(), _name);
216  }
217 
224  CameraPoint const &fromCameraPoint,
225  CameraSys const &toSys
226  ) const {
227  return CameraPoint(
228  _transformMap.transform(fromCameraPoint.getPoint(), fromCameraPoint.getCameraSys(), toSys),
229  toSys);
230  }
231 
240  CameraPoint const &fromCameraPoint,
241  CameraSysPrefix const &toSys
242  ) const {
243  return transform(fromCameraPoint, makeCameraSys(toSys));
244  }
245 
246 private:
247  typedef boost::unordered_map<std::string, table::AmpInfoCatalog::const_iterator> _AmpInfoMap;
258  void _init();
259 
260  std::string _name;
261  int _id;
263  std::string _serial;
270 };
271 
272 }}}
273 
274 #endif
boost::unordered_map< std::string, table::AmpInfoCatalog::const_iterator > _AmpInfoMap
Definition: Detector.h:247
Orientation const getOrientation() const
Definition: Detector.h:123
std::vector< geom::Point2D > getCorners(CameraSys const &cameraSys) const
Definition: Detector.cc:56
lsst::afw::table::AmpInfoCatalog::const_iterator end() const
Definition: Detector.h:135
table::Key< std::string > name
Definition: ApCorrMap.cc:71
std::string getSerial() const
Definition: Detector.h:102
Geometry and electronic information about raw amplifier images.
Definition: AmpInfo.h:77
geom::Extent2D getPixelSize() const
Definition: Detector.h:126
geom::Point2D getPoint() const
Definition: CameraPoint.h:40
geom::Box2I _bbox
bounding box
Definition: Detector.h:264
A custom container class for records, based on std::vector.
Definition: Catalog.h:94
lsst::afw::table::AmpInfoRecord const & operator[](size_t i) const
Definition: Detector.h:142
Point< double, 2 > Point2D
Definition: Point.h:286
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
Definition: Detector.h:223
CameraPoint getCenter(CameraSys const &cameraSys) const
Definition: Detector.cc:65
reference at(size_type i) const
Return the record at index i (throws std::out_of_range).
Definition: Catalog.h:430
lsst::afw::geom::Box2I getBBox() const
Definition: Detector.h:105
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:401
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSysPrefix const &toSys) const
Definition: Detector.h:239
An integer coordinate rectangle.
Definition: Box.h:53
CameraPoint makeCameraPoint(geom::Point2D point, CameraSys cameraSys) const
Definition: Detector.h:187
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:269
Point2D transform(Point2D const &fromPoint, CoordSysT const &fromSys, CoordSysT const &toCoordSys) const
DetectorType getType() const
Definition: Detector.h:99
CameraTransformMap const getTransformMap() const
Definition: Detector.h:129
lsst::afw::table::AmpInfoCatalog::const_iterator begin() const
Definition: Detector.h:132
DetectorType _type
type of detectorsize_t
Definition: Detector.h:262
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Definition: Detector.h:209
Iterator class for CatalogT.
Definition: Catalog.h:34
std::map< CameraSys, boost::shared_ptr< XYTransform const > > Transforms
Definition: TransformMap.h:67
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)
Definition: Detector.cc:31
lsst::afw::table::AmpInfoCatalog const getAmpInfoCatalog() const
Definition: Detector.h:120
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:265
bool hasTransform(CameraSys const &cameraSys) const
Definition: Detector.cc:84
std::string getName() const
Definition: Detector.h:94
CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const
Definition: Detector.h:214
CameraSys getCameraSys() const
Definition: CameraPoint.h:41
Orientation _orientation
position and orientation of detector in focal plane
Definition: Detector.h:267
geom::Extent2D _pixelSize
pixel size (mm)
Definition: Detector.h:268
Virtual base class for 2D transforms.
Definition: XYTransform.h:48
#define CONST_PTR(...)
Definition: base.h:47
CameraPoint makeCameraPoint(geom::Point2D point, CameraSysPrefix cameraSysPrefix) const
Definition: Detector.h:197
_AmpInfoMap _ampNameIterMap
map of amplifier name: catalog iterator
Definition: Detector.h:266
std::string _name
name of detector&#39;s location in the camera
Definition: Detector.h:260
std::string _serial
serial &quot;number&quot; that identifies the physical detector
Definition: Detector.h:263
int _id
detector numeric ID
Definition: Detector.h:261
std::string getSysName() const
Definition: CameraSys.h:55
boost::shared_ptr< afw::geom::XYTransform const > getTransform(CameraSys const &cameraSys) const
Definition: Detector.cc:92