Program Listing for File mag.h

Return to documentation for file (src/lib/mag.h)

/*
 *  Class with all the tools used to create the grid of SED in e(b-v), redshift,
 * etc and create the library of modeled magnitude and k-corrections
 */

#ifndef MAG_H_
#define MAG_H_

#include "SED.h"
#include "cosmology.h"
#include "ext.h"  // extinction law class
#include "flt.h"
#include "globals.h"
#include "keyword.h"
#include "opa.h"  // IGM opacity class
#ifdef _OPENMP
#include <omp.h>
#endif

class Mag {
 protected:
  object_type object;
  string config;
  cosmo lcdm;
  string filtFile, magtyp;
  bool outasc, verbose, add_dust;
  vector<string> extlaw;
  int nextlaw;
  vector<double> ebv;
  int nebv;
  vector<int> modext;
  double dz, zmin, zmax;
  string lib, colib;

  // only for the galaxy, but much easier to keep them here
  string emlines = "NO";

  string sedlibFile, docFile, binOutFile, datFile;
  ifstream ssedIn;
  ofstream sdocOut, sbinOut, sdatOut;

  vector<ext> extAll;
  vector<flt> allFlt;
  vector<GalSED> B12SED;
  vector<double> gridz;
  vector<double> gridT, gridDM;

  vector<double> magko;

  vector<opa> opaAll;

 public:
  Mag(keymap &key_analysed);
  Mag(){};
  virtual ~Mag();

  static ifstream open_opa_files();
  void read_ext();
  static vector<opa> read_opa();
  static vector<flt> read_flt(const string &);

  // Read the long wavelength Bethermin+2012 templates
  // to add the dust emission to the BC03 templates
  void read_B12();

  void def_zgrid();

  inline void set_zgrid(double dz, double zmin, double zmax) {
    gridz = zgrid(dz, zmin, zmax);
  }

  void write_doc();

  virtual void print_info();
  void open_files();
  void close_files();
  virtual void read_SED() = 0;
};

class StarMag : public Mag {
 public:
  StarMag(keymap &key_analysed);
  StarMag(){};
  ~StarMag(){};

  void print_info();
  void read_SED();
  vector<StarSED> make_maglib(const StarSED &);
  void write_mag(const vector<StarSED> &);
};

class QSOMag : public Mag {
 public:
  QSOMag(keymap &key_analysed);
  QSOMag(){};
  ~QSOMag(){};

  void print_info();
  void read_SED();
  vector<QSOSED> make_maglib(const QSOSED &);
  void write_mag(const vector<QSOSED> &);
};

class GalMag : public Mag {
 private:
  vector<double> fracEm;

 public:
  GalMag(keymap &key_analysed);
  GalMag(){};
  ~GalMag(){};

  void print_info();
  void read_SED();
  vector<GalSED> make_maglib(GalSED &);
  void write_mag(const vector<GalSED> &);
};

#endif /* MAG_H_ */