00001 #ifndef BASISFUNCIMAGER1D_H
00002 #define BASISFUNCIMAGER1D_H
00003
00004 #include <string>
00005 #include "tnt_array1d.h"
00006 #include "tnt_array2d.h"
00007 #include "parametermap.h"
00008 #include "general_imager1d.h"
00009
00010 using namespace TNT;
00011
00012
00013
00014
00015
00016 class CKernelMatrix: public Array2D<double> {
00017
00018 public:
00019 int l;
00020 int nq;
00021 double qoffset;
00022 double dq;
00023 int ncoeffs;
00024 bool initialized;
00025 string particle1;
00026 string particle2;
00027
00028
00029 CKernelMatrix(void):l(-1),initialized(false){}
00030
00031 CKernelMatrix(int _l, int _nq, double _q0, double _dq, int _nc, bool _i, string _p1, string _p2):
00032 Array2D<double>(_nq,_nc,0.0),
00033 l(_l),
00034 nq(_nq),
00035 qoffset(_q0),
00036 dq(_dq),
00037 ncoeffs(_nc),
00038 initialized(_i),
00039 particle1(_p1),
00040 particle2(_p2){}
00041
00042 CKernelMatrix(const CKernelMatrix& other):
00043 Array2D<double>(other),
00044 l(other.l),
00045 nq(other.nq),
00046 qoffset(other.qoffset),
00047 dq(other.dq),
00048 ncoeffs(other.ncoeffs),
00049 initialized(other.initialized),
00050 particle1(other.particle1),
00051 particle2(other.particle2){}
00052
00053
00054 bool operator==(const CKernelMatrix other){
00055 if ((other.l<0)||(l<0)) return false;
00056 return
00057 (
00058 l == other.l &&
00059 nq == other.nq &&
00060 qoffset == other.qoffset &&
00061 dq == other.dq &&
00062 ncoeffs == other.ncoeffs &&
00063 initialized == other.initialized &&
00064 particle1 == other.particle1 &&
00065 particle2 == other.particle2
00066 );
00067 }
00068
00069 bool operator!=(const CKernelMatrix other){return !(operator==(other));}
00070 };
00071
00072
00073
00074
00075 class CBasisFuncImager1d: public CGeneralImager1d{
00076
00077 public:
00078
00079
00080 CBasisFuncImager1d( void ):
00081 CGeneralImager1d(),
00082 constrain_origin(false),
00083 constrain_rmax_zero_slope(false),
00084 constrain_rmax_zero(false),
00085 kmtx(),
00086 conmtx(),
00087 convec(0),
00088 num_constraints(0),
00089 sourcePtr(0),
00090 __l(0),
00091 __j(0){}
00092
00093
00094 ~CBasisFuncImager1d( void ){}
00095
00096
00097 bool Read( const parameterMap& m );
00098 bool Write( parameterMap& m );
00099
00100
00101 bool convertCorrelationToSource( const CCorrFtn1dHisto& corrin, CSourceFtnBase& souout, const parameterMap& m, const CKernel* _kernelPtr=NULL );
00102 bool convertSourceToCorrelation( const CSourceFtnBase& souin, CCorrFtn1dHisto& corrout, const parameterMap& m, const CKernel* _kernelPtr=NULL );
00103
00104
00105 virtual double imageit(CBasisFunctionExpansion1d& souout);
00106 virtual void unimageit(const CBasisFunctionExpansion1d& souin, CCorrFtn1dHisto& corrout);
00107
00108
00109 bool constrain_origin;
00110 bool constrain_rmin_zero;
00111 bool constrain_rmax_zero_slope;
00112 bool constrain_rmax_zero;
00113
00114
00115 CKernelMatrix kmtx;
00116
00117
00118 Array2D< double > conmtx;
00119 Array1D< double > convec;
00120 int num_constraints;
00121
00122
00123 const CBasisFunctionExpansion1d* sourcePtr;
00124 int __l, __j;
00125
00126
00127 bool set_no_data( CSourceFtnBase& souout );
00128 bool initialize_source( const CCorrFtn1dHisto& corrin, CSourceFtnBase& souout, const parameterMap& m );
00129 void set_constraints(const CBasisFunctionExpansion1d& souout);
00130 void set_kmtx(const CCorrFtn1dHisto& corrin, const CBasisFunctionExpansion1d& souout, const parameterMap& m );
00131 static void kp_integrand(void* classptr, int* ndim, double* x, int* numfunc, double* f);
00132 };
00133
00134 #endif