lsst.jointcal  16.0-20-g17d57d5+5
BaseStar.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_BASE_STAR_H
3 #define LSST_JOINTCAL_BASE_STAR_H
4 
5 #include <iostream>
6 #include <cstdio>
7 #include <string>
8 #include <sstream>
9 
10 #include "lsst/jointcal/FatPoint.h"
11 #include "lsst/jointcal/StarList.h"
12 
13 namespace lsst {
14 namespace jointcal {
15 
16 namespace {
18 double magFromFlux(double instFlux) { return -2.5 * std::log10(instFlux); }
19 
21 double magErrFromFluxErr(double instFlux, double instFluxErr) {
22  return 2.5 / std::log(10) * (instFluxErr / instFlux);
23 }
24 } // namespace
25 
27 class BaseStar : public FatPoint {
28 public:
30  x = 0;
31  y = 0;
32  _flux = 0;
33  };
35  BaseStar(double xx, double yy, double flux, double fluxErr)
36  : FatPoint(xx, yy),
37  _flux(flux),
38  _fluxErr(fluxErr),
39  _mag(magFromFlux(flux)),
40  _magErr(magErrFromFluxErr(flux, fluxErr)){};
41  BaseStar(Point const &point, double flux, double fluxErr, double mag, double magErr)
42  : FatPoint(point),
43  _flux(flux),
44  _fluxErr(fluxErr),
45  _mag(magFromFlux(flux)),
46  _magErr(magErrFromFluxErr(flux, fluxErr)){};
47 
49  double getX() const { return x; }
51  double getY() const { return y; }
52 
54  friend std::ostream &operator<<(std::ostream &stream, BaseStar const &s) {
55  s.dump(stream);
56  return stream;
57  }
58 
59  virtual void dump(std::ostream &stream = std::cout) const {
60  stream << "x: " << x << " y: " << y << " flux: " << _flux << " fluxErr: " << _fluxErr;
61  }
62 
63  BaseStar &operator=(Point const &point) {
64  x = point.x;
65  y = point.y;
66  return (*this);
67  };
68 
69  static const char *typeName() { return "BaseStar"; }
70 
71  virtual ~BaseStar(){};
72 
73  double getFlux() const { return _flux; }
74  double &getFlux() { return _flux; }
75  void setFlux(double flux) { _flux = flux; }
76 
77  double getFluxErr() const { return _fluxErr; }
78  void setFluxErr(double fluxErr) { _fluxErr = fluxErr; }
79 
80  double getMag() const { return _mag; }
81  double &getMag() { return _mag; }
82 
83  double getMagErr() const { return _magErr; }
84  void setMagErr(double magErr) { _magErr = magErr; }
85 
86 protected:
87  // on-sky flux, in Maggies
88  double _flux;
89  double _fluxErr;
90 
91  // on-sky magnitude
92  double _mag;
93  double _magErr;
94 };
95 
97 
98 typedef BaseStarList::const_iterator BaseStarCIterator;
99 typedef BaseStarList::iterator BaseStarIterator;
100 } // namespace jointcal
101 } // namespace lsst
102 
103 #endif // LSST_JOINTCAL_BASE_STAR_H
BaseStarList::const_iterator BaseStarCIterator
Definition: BaseStar.h:98
double getX() const
access stuff.
Definition: BaseStar.h:49
virtual void dump(std::ostream &stream=std::cout) const
utility
Definition: BaseStar.h:59
A point in a plane.
Definition: Point.h:13
StarList< BaseStar > BaseStarList
Definition: BaseStar.h:96
T log(T... args)
BaseStarList::iterator BaseStarIterator
Definition: BaseStar.h:99
double getFluxErr() const
Definition: BaseStar.h:77
T log10(T... args)
A Point with uncertainties.
Definition: FatPoint.h:11
double x
coordinate
Definition: Point.h:18
The base class for handling stars. Used by all matching routines.
Definition: BaseStar.h:27
std::lists of Stars.
Definition: StarList.h:35
Class for a simple mapping implementing a generic Gtransfo.
BaseStar & operator=(Point const &point)
Definition: BaseStar.h:63
static const char * typeName()
Definition: BaseStar.h:69
double getMag() const
Definition: BaseStar.h:80
double getFlux() const
Definition: BaseStar.h:73
void setFluxErr(double fluxErr)
Definition: BaseStar.h:78
double getY() const
Definition: BaseStar.h:51
double getMagErr() const
Definition: BaseStar.h:83
void setFlux(double flux)
Definition: BaseStar.h:75
BaseStar(Point const &point, double flux, double fluxErr, double mag, double magErr)
Definition: BaseStar.h:41
friend std::ostream & operator<<(std::ostream &stream, BaseStar const &s)
allows std::cout << aBaseStar;
Definition: BaseStar.h:54
STL class.
void setMagErr(double magErr)
Definition: BaseStar.h:84
BaseStar(double xx, double yy, double flux, double fluxErr)
constructor
Definition: BaseStar.h:35