00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "AIDA_FitResult.h"
00032 #include "FML/debug.h"
00033 #include "FML/util.h"
00034
00035 namespace Anaphe {
00036 namespace AIDA_Fitter_FML {
00037
00038
00039
00040 AIDA_FitResult::AIDA_FitResult( std::auto_ptr<Anaphe::FML::FitResult> r) :
00041 m_result(r){
00042 assert(m_result.get());
00043
00044 std::auto_ptr<Anaphe::FML::IFMLFunction> f(&m_result->fittedFunction() );
00045 assert (f.get());
00046 std::auto_ptr<Anaphe::AIDA_Function_FML::AIDA_FunctionAdapter>
00047 aida_f(new Anaphe::AIDA_Function_FML::AIDA_FunctionAdapter(f) );
00048 m_fadapter = aida_f;
00049 assert(m_fadapter.get());
00050
00051 fillAnnotation(m_fadapter.get());
00052 }
00053
00054
00055 AIDA_FitResult::~AIDA_FitResult()
00056 {
00057 }
00058
00059 AIDA_FitResult::AIDA_FitResult(const AIDA_FitResult &)
00060 {
00061 }
00062
00063 AIDA_FitResult & AIDA_FitResult::operator = (const AIDA_FitResult &rhs)
00064 {
00065 if (this == &rhs) return *this;
00066
00067 return *this;
00068 }
00069
00070
00071
00073
00074 bool AIDA_FitResult::isValid()
00075 {
00076 return m_result->isValid();
00077 }
00078
00079 int AIDA_FitResult::fitStatus()
00080 {
00081 return m_result->fitStatus();
00082 }
00083
00084 AIDA::IFunction * AIDA_FitResult::fittedFunction()
00085 {
00086 return m_fadapter.get();
00087 }
00088
00089 double AIDA_FitResult::quality()
00090 {
00091 return m_result->quality();
00092 }
00093
00094 int AIDA_FitResult::ndf()
00095 {
00096 return m_result->ndf();
00097 }
00098
00099 const std::vector<double> & AIDA_FitResult::fittedParameters() const
00100 {
00101 return m_fadapter->parameters();
00102 }
00103 const std::vector<std::string> & AIDA_FitResult::fittedParameterNames() const
00104 {
00105 return m_fadapter->parameterNames();
00106 }
00107 double AIDA_FitResult::fittedParameter(std::string & name) {
00108 return m_fadapter->parameter(name);
00109 }
00110
00111
00112
00113 const std::vector<double> & AIDA_FitResult::errors() const
00114 {
00115 return m_result->errors();
00116 }
00117
00118 const std::vector<double> & AIDA_FitResult::errorsPlus() const
00119 {
00120 return m_result->errorsPlus();
00121 }
00122
00123 const std::vector<double> & AIDA_FitResult::errorsMinus() const
00124 {
00125 return m_result->errorsMinus();
00126 }
00127
00128 double AIDA_FitResult::covMatrixElement(int i, int j)
00129 {
00130 return m_result->covMatrixElement(i,j);
00131 }
00132
00133 std::string AIDA_FitResult::fitMethodName()
00134 {
00135 return m_result->fitConfig().fitMethodName();
00136 }
00137
00138 std::string AIDA_FitResult::engineName()
00139 {
00140 return m_result->fitConfig().engineName();
00141 }
00142
00143 std::string AIDA_FitResult::dataDescription()
00144 {
00145 return m_result->dataDescription();
00146 }
00147
00148 const std::vector<std::string> & AIDA_FitResult::constraints()
00149 {
00150 return m_constr;
00151 }
00152
00153 AIDA::IFitParameterSettings * AIDA_FitResult::fitParameterSettings(std::string name)
00154 {
00155 Anaphe::FML::FitParameterSettings *ps_fml = &m_result->fitConfig().fitParameterSettings(name);
00156
00157
00158 AIDA_FitParameterSettings * ps = new AIDA_FitParameterSettings(ps_fml);
00159 m_fitpar[name] = ps;
00160
00161 return m_fitpar[name];
00162 }
00163
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176 void AIDA_FitResult::setIsValid(bool yes)
00177 {
00178 INFO_MSG("AIDA_FitResult: setters not implemented");
00179
00180
00181
00182
00183 }
00184
00185 void AIDA_FitResult::setFitStatus(int status)
00186 {
00187 INFO_MSG("AIDA_FitResult: setters not implemented");
00188
00189
00190
00191
00192 }
00193
00194 void AIDA_FitResult::setFittedFunction(AIDA::IFunction * f)
00195 {
00196
00197 INFO_MSG("AIDA_FitResult: setters not implemented");
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 }
00215
00216 void AIDA_FitResult::setQuality(double quality)
00217 {
00218 INFO_MSG("AIDA_FitResult: setters not implemented");
00219 }
00220
00221 void AIDA_FitResult::setNdf(int ndf)
00222 {
00223 INFO_MSG("AIDA_FitResult: setters not implemented");
00224 }
00225
00226 void AIDA_FitResult::setCovMatrixElement(int i, int j, double val)
00227 {
00228 INFO_MSG("AIDA_FitResult: setters not implemented");
00229 }
00230
00231 void AIDA_FitResult::setFitMethodName(std::string name)
00232 {
00233 INFO_MSG("AIDA_FitResult: setters not implemented");
00234 }
00235 void AIDA_FitResult::setEngineName(std::string name)
00236 {
00237 INFO_MSG("AIDA_FitResult: setters not implemented");
00238 }
00239
00240 void AIDA_FitResult::setDataDescription(std::string descr)
00241 {
00242 INFO_MSG("AIDA_FitResult: setters not implemented");
00243 }
00244 void AIDA_FitResult::setConstraints(const std::vector<std::string> & cv)
00245 {
00246 INFO_MSG("AIDA_FitResult: setters not implemented");
00247 }
00248
00249 void AIDA_FitResult::setFitParameterSettings(std::string name, AIDA::IFitParameterSettings * s)
00250 {
00251 INFO_MSG("AIDA_FitResult: setters not implemented");
00252 }
00253
00254
00255
00256
00257
00258 void AIDA_FitResult::fillAnnotation(AIDA::IFunction * f) {
00259 AIDA::IAnnotation & anno = f->annotation();
00260
00261 std::string s(Util::to_string(quality() ) + " / " + Util::to_string(ndf() ) );
00262 anno.addItem("Fit Method ", fitMethodName() , false);
00263 anno.addItem("Fit Quality / ndf ", s , false);
00264 std::vector<std::string> parNames = f->parameterNames();
00265 std::vector<double> parValues = f->parameters();
00266 for (int i = 0; i < f->numberOfParameters() ; ++ i) {
00267 std::string txt = Util::to_string( parValues[i] ) + " +/- " + Util::to_string( errors()[i] );
00268 anno.setValue( parNames[i], txt );
00269 }
00270
00271 }
00272
00273
00274 }
00275 }