lsst.jointcal  master-gc935ebf72c+13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 #define MEMPIX2DISK 1
17 
18 #define DECALAGE_IJ_XY 0.
19 #define DECALAGE_XY_IJ 0.
20 
22 // tell other pieces of code that BaseStar now derives from FatPoint (instead of Point)
23 #define BASESTAR_HAS_POSITION_ERRORS
24 
26 class BaseStar : public FatPoint {
27 protected:
28  double _flux;
29 
30 public:
32  x = 0;
33  y = 0;
34  _flux = 0;
35  };
37  BaseStar(double xx, double yy, double flux) : FatPoint(xx, yy), _flux(flux){};
38  BaseStar(const Point &point, double flux) : FatPoint(point), _flux(flux){};
39 
41  double getX() const { return x; }
43  double getY() const { return y; }
44 
46  friend std::ostream &operator<<(std::ostream &stream, const BaseStar &s) {
47  s.dump(stream);
48  return stream;
49  }
50 
51  virtual std::string __str__() const {
52  std::stringstream s;
53  dump(s);
54  return s.str();
55  }
56 
57  virtual void dump(std::ostream &stream = std::cout) const {
58  stream << "x: " << x << " y: " << y << " flux: " << _flux;
59  }
60 
61  BaseStar &operator=(const Point &point) {
62  this->x = point.x;
63  this->y = point.y;
64  return (*this);
65  };
66 
67  static const char *typeName() { return "BaseStar"; }
68 
69  virtual ~BaseStar(){};
70 
71  double getFlux() const { return _flux; }
72  double &getFlux() { return _flux; }
73  void setFlux(double flux) { _flux = flux; }
74 };
75 
77 bool decreasingFlux(const BaseStar *star1, const BaseStar *star2);
78 
79 int decodeFormat(const char *formatLine, const char *starName);
80 
82 
83 typedef BaseStarList::const_iterator BaseStarCIterator;
84 typedef BaseStarList::iterator BaseStarIterator;
85 }
86 } // namespace lsst
87 
88 #endif // LSST_JOINTCAL_BASE_STAR_H
BaseStarList::const_iterator BaseStarCIterator
Definition: BaseStar.h:83
A point in a plane.
Definition: Point.h:13
StarList< BaseStar > BaseStarList
Definition: BaseStar.h:81
bool decreasingFlux(const BaseStar *star1, const BaseStar *star2)
enables to sort easily a starList (of anything that derives from BaseStar)
Definition: BaseStar.cc:14
BaseStarList::iterator BaseStarIterator
Definition: BaseStar.h:84
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:26
double getFlux() const
Definition: BaseStar.h:71
std::lists of Stars.
Definition: StarList.h:35
virtual std::string __str__() const
Definition: BaseStar.h:51
friend std::ostream & operator<<(std::ostream &stream, const BaseStar &s)
allows std::cout &lt;&lt; aBaseStar;
Definition: BaseStar.h:46
static const char * typeName()
Definition: BaseStar.h:67
void setFlux(double flux)
Definition: BaseStar.h:73
virtual void dump(std::ostream &stream=std::cout) const
utility
Definition: BaseStar.h:57
BaseStar & operator=(const Point &point)
Definition: BaseStar.h:61
int decodeFormat(const char *formatLine, const char *starName)
Definition: BaseStar.cc:24
double getX() const
access stuff.
Definition: BaseStar.h:41
BaseStar(double xx, double yy, double flux)
constructor
Definition: BaseStar.h:37
BaseStar(const Point &point, double flux)
Definition: BaseStar.h:38
double getY() const
Definition: BaseStar.h:43