LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
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  );
89 
90  ~Detector() {}
91 
93  std::string getName() const { return _name; }
94 
96  int getId() const { return _id; }
97 
98  DetectorType getType() const { return _type; }
99 
101  std::string getSerial() const { return _serial; }
102 
105 
107  std::vector<geom::Point2D> getCorners(CameraSys const &cameraSys) const;
108 
110  std::vector<geom::Point2D> getCorners(CameraSysPrefix const &cameraSysPrefix) const;
111 
113  CameraPoint getCenter(CameraSys const &cameraSys) const;
114 
116  CameraPoint getCenter(CameraSysPrefix const &cameraSysPrefix) const;
117 
120 
122  Orientation const getOrientation() const { return _orientation; }
123 
126 
129 
132 
135 
141  lsst::afw::table::AmpInfoRecord const & operator[](size_t i) const { return _ampInfoCatalog.at(i); }
142 
148  lsst::afw::table::AmpInfoRecord const & operator[](std::string const &name) const;
149 
153  size_t size() const {return _ampInfoCatalog.size(); }
154 
161  geom::Point2D point,
162  CameraSys cameraSys
163  ) const {
164  return CameraPoint(point, cameraSys);
165  }
166 
171  geom::Point2D point,
172  CameraSysPrefix cameraSysPrefix
173  ) const {
174  return CameraPoint(point, makeCameraSys(cameraSysPrefix));
175  }
176 
182  CameraSys const makeCameraSys(CameraSys const &cameraSys) const { return cameraSys; }
183 
187  CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const {
188  return CameraSys(cameraSysPrefix.getSysName(), _name);
189  }
190 
197  CameraPoint const &fromCameraPoint,
198  CameraSys const &toSys
199  ) const {
200  return CameraPoint(
201  _transformMap.transform(fromCameraPoint.getPoint(), fromCameraPoint.getCameraSys(), toSys),
202  toSys);
203  }
204 
213  CameraPoint const &fromCameraPoint,
214  CameraSysPrefix const &toSys
215  ) const {
216  return transform(fromCameraPoint, makeCameraSys(toSys));
217  }
218 
219 private:
220  typedef boost::unordered_map<std::string, table::AmpInfoCatalog::const_iterator> _AmpInfoMap;
231  void _init();
232 
233  std::string _name;
234  int _id;
236  std::string _serial;
243 };
244 
245 }}}
246 
247 #endif
boost::unordered_map< std::string, table::AmpInfoCatalog::const_iterator > _AmpInfoMap
Definition: Detector.h:220
Orientation const getOrientation() const
Definition: Detector.h:122
std::vector< geom::Point2D > getCorners(CameraSys const &cameraSys) const
Definition: Detector.cc:56
lsst::afw::table::AmpInfoCatalog::const_iterator end() const
Definition: Detector.h:134
std::string getSerial() const
Definition: Detector.h:101
Geometry and electronic information about raw amplifier images.
Definition: AmpInfo.h:76
geom::Extent2D getPixelSize() const
Definition: Detector.h:125
geom::Point2D getPoint() const
Definition: CameraPoint.h:40
geom::Box2I _bbox
bounding box
Definition: Detector.h:237
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:141
CameraPoint transform(CameraPoint const &fromCameraPoint, CameraSys const &toSys) const
Definition: Detector.h:196
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:104
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
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:212
An integer coordinate rectangle.
Definition: Box.h:53
CameraPoint makeCameraPoint(geom::Point2D point, CameraSys cameraSys) const
Definition: Detector.h:160
CameraTransformMap _transformMap
registry of coordinate transforms
Definition: Detector.h:242
Point2D transform(Point2D const &fromPoint, CoordSysT const &fromSys, CoordSysT const &toCoordSys) const
DetectorType getType() const
Definition: Detector.h:98
CameraTransformMap const getTransformMap() const
Definition: Detector.h:128
lsst::afw::table::AmpInfoCatalog::const_iterator begin() const
Definition: Detector.h:131
DetectorType _type
type of detectorsize_t
Definition: Detector.h:235
CameraSys const makeCameraSys(CameraSys const &cameraSys) const
Definition: Detector.h:182
Iterator class for CatalogT.
Definition: Catalog.h:34
std::map< CameraSys, boost::shared_ptr< XYTransform const > > Transforms
Definition: TransformMap.h:67
lsst::afw::table::AmpInfoCatalog const getAmpInfoCatalog() const
Definition: Detector.h:119
table::AmpInfoCatalog _ampInfoCatalog
list of amplifier data
Definition: Detector.h:238
std::string getName() const
Definition: Detector.h:93
CameraSys const makeCameraSys(CameraSysPrefix const &cameraSysPrefix) const
Definition: Detector.h:187
CameraSys getCameraSys() const
Definition: CameraPoint.h:41
Orientation _orientation
position and orientation of detector in focal plane
Definition: Detector.h:240
geom::Extent2D _pixelSize
pixel size (mm)
Definition: Detector.h:241
CameraPoint makeCameraPoint(geom::Point2D point, CameraSysPrefix cameraSysPrefix) const
Definition: Detector.h:170
_AmpInfoMap _ampNameIterMap
map of amplifier name: catalog iterator
Definition: Detector.h:239
std::string _name
name of detector&#39;s location in the camera
Definition: Detector.h:233
std::string _serial
serial &quot;number&quot; that identifies the physical detector
Definition: Detector.h:236
int _id
detector numeric ID
Definition: Detector.h:234
std::string getSysName() const
Definition: CameraSys.h:55