MnClassEngine.hh 3.73 KB
Newer Older
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
//--------------------------------------------------------------------------
//
// Description:
// 	class MnClassEngine :
// adapter to CLASS from MINUIT params (using Adapter pattern)
// - strips nuisance parameters 
// - converts some keywords 
// Author List:
//	Stephane Plaszczynski (plaszczy@lal.in2p3.fr)
//
// History (add to end):
//	creation:   Tue Mar 13 15:04:01 CET 2012 
//
//------------------------------------------------------------------------

#ifndef MnClassEngine_hh
#define MnClassEngine_hh

19
#include "Variables.hh"
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#include "Engine.hh"
#include "ClassEngine.hh"

#include<vector>
#include<string>

class ClassEngine;
class ClassParams;
class ClassAdapter;

class MnClassEngine : public Engine
{

public:

  //constructors
36
  MnClassEngine(const Variables& upar,
37 38
		const ClassParams& config,
		const std::string& prefile);
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
39 40

  // destructor
41
  virtual ~MnClassEngine();
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
42 43

  //this will update the CLASS computations for a realization of par 
44
  //conistent with the MnUserVariables
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
45 46
  bool updateParValues(const std::vector<double>& minuitPars);

Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
47

48
  virtual std::string name() const {return "MnClassEngine";}
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
49

Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63
  //then read with this one
  inline void getCls(const std::vector<unsigned>& lVec, //input 
	      std::vector<double>& cltt, 
	      std::vector<double>& clte, 
	      std::vector<double>& clee, 
	      std::vector<double>& clbb) { return klass->getCls(lVec,cltt,clte,clee,clbb);}
  
  
  bool getLensing(const std::vector<unsigned>& lVec, //input 
		  std::vector<double>& clpp, 
		  std::vector<double>& cltp, 
		  std::vector<double>& clep) {return klass->getLensing(lVec,clpp,cltp,clep);}

  //forward
64 65 66 67 68 69 70 71
  //services
  virtual bool has_Background() const {return klass-> has_Background();}
  virtual bool has_CMB_Cl() const {return klass->has_CMB_Cl();}
  virtual bool has_CMB_ClPol() const {return klass->has_CMB_ClPol();}
  virtual bool has_CMB_Lensing() const {return klass->has_CMB_Lensing();}
  virtual bool has_Pklin() const {return klass->has_Pklin();}
  virtual bool has_PkNL() const {return klass->has_PkNL();}

72 73


74

Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
75 76 77 78 79 80 81 82 83 84 85 86
  inline double z_drag() const {return klass->z_drag();}
  inline double rs_drag() const {return klass->rs_drag();}
  double get_Dv(double z) {return klass->get_Dv(z);}
  double get_Fz(double z) {return klass->get_Fz(z);}
  double get_H(double z) {return klass->get_H(z);}
  double get_Da(double z) {return klass->get_Da(z);}
  double get_f(double z) {return klass->get_f(z);}
  double get_sigma8(double z) {return klass->get_sigma8(z);}
  double get_DMod(double z){return klass->get_DMod(z);}
  double get_tau_reio() const {return klass->get_tau_reio();}
  double get_z_reio() const {return klass->get_z_reio();}
  double get_H0() const {return klass->get_H0();}
87
  double get_h() const {return klass->get_h();}
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
88 89 90
  double theta() const {return klass->theta();}
  double YHe() const {return klass->YHe();}
  double Omega_m() const {return klass->Omega_m();}
91 92 93
  double z_rec() const {return klass->z_rec();}
  double rs_rec() const {return klass->rs_rec();}
  
94
  double com_distance(double z) {return klass->com_distance(z);}
95 96
  double get_growthD(double z) {return klass->get_growthD(z);}

Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
97 98
  virtual double get_Pklin(double k, double z)  { return klass->get_Pklin(k,z);}
  virtual double get_PkNL(double k, double z)   { return klass->get_PkNL(k,z);}
99 100
 
  inline bool get_Pkvec(const std::vector<double>& knodes, const std::vector<double>& zvec, std::vector<double>& pks) {return klass->get_Pkvec(knodes,zvec,pks);}
101
  inline bool get_Pkvec(const std::vector<double>& knodes, const double& z, std::vector<double>& pks) {return klass->get_Pkvec(knodes,z,pks);}
102

Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119

  void writeCls(std::ostream &o) {klass->writeCls(o);}

  ClassEngine* getClass() {return klass;}

private:
  std::vector<ClassAdapter*> adapter;

  ClassEngine* klass;
  ClassParams classpars;



};

#endif