/usr/include/root/Fit/FitConfig.h is in libroot-math-mathcore-dev 5.34.19+dfsg-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | // @(#)root/mathcore:$Id$
// Author: L. Moneta Thu Sep 21 16:21:29 2006
/**********************************************************************
* *
* Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
* *
* *
**********************************************************************/
// Header file for class FitConfig
#ifndef ROOT_Fit_FitConfig
#define ROOT_Fit_FitConfig
#ifndef ROOT_Fit_ParameterSettings
#include "Fit/ParameterSettings.h"
#endif
#ifndef ROOT_Math_MinimizerOptions
#include "Math/MinimizerOptions.h"
#endif
#ifndef ROOT_Math_IParamFunctionfwd
#include "Math/IParamFunctionfwd.h"
#endif
#include <vector>
namespace ROOT {
namespace Math {
class Minimizer;
class MinimizerOptions;
}
namespace Fit {
class FitResult;
//___________________________________________________________________________________
/**
Class describing the configuration of the fit, options and parameter settings
using the ROOT::Fit::ParameterSettings class
@ingroup FitMain
*/
class FitConfig {
public:
/**
Default constructor
*/
FitConfig (unsigned int npar = 0);
/*
Copy constructor
*/
FitConfig(const FitConfig & rhs);
/**
Destructor
*/
~FitConfig ();
/*
Assignment operator
*/
FitConfig & operator= (const FitConfig & rhs);
/**
get the parameter settings for the i-th parameter (const method)
*/
const ParameterSettings & ParSettings(unsigned int i) const { return fSettings.at(i); }
/**
get the parameter settings for the i-th parameter (non-const method)
*/
ParameterSettings & ParSettings(unsigned int i) { return fSettings.at(i); }
/**
get the vector of parameter settings (const method)
*/
const std::vector<ROOT::Fit::ParameterSettings> & ParamsSettings() const { return fSettings; }
/**
get the vector of parameter settings (non-const method)
*/
std::vector<ROOT::Fit::ParameterSettings> & ParamsSettings() { return fSettings; }
/**
number of parameters settings
*/
unsigned int NPar() const { return fSettings.size(); }
/**
set the parameter settings from a model function.
Create always new parameter setting list from a given model function
*/
void CreateParamsSettings(const ROOT::Math::IParamMultiFunction & func);
/**
set the parameter settings from number of parameters and a vector of values and optionally step values. If there are not existing or number of parameters does not match existing one, create a new parameter setting list.
*/
void SetParamsSettings(unsigned int npar, const double * params, const double * vstep = 0);
/*
Set the parameter settings from a vector of parameter settings
*/
void SetParamsSettings (const std::vector<ROOT::Fit::ParameterSettings>& pars ) {
fSettings = pars;
}
/*
Set the parameter settings from a fit Result
*/
void SetFromFitResult (const FitResult & rhs);
/**
create a new minimizer according to chosen configuration
*/
ROOT::Math::Minimizer * CreateMinimizer();
/**
access to the minimizer control parameter (non const method)
*/
ROOT::Math::MinimizerOptions & MinimizerOptions() { return fMinimizerOpts; }
#ifndef __CINT__ // this method fails on Windows
/**
set all the minimizer options using class MinimizerOptions
*/
void SetMinimizerOptions(const ROOT::Math::MinimizerOptions & minopt);
#endif
/**
set minimizer type
*/
void SetMinimizer(const char * type, const char * algo = 0) {
if (type) fMinimizerOpts.SetMinimizerType(type);
if (algo) fMinimizerOpts.SetMinimizerAlgorithm(algo);
}
/**
return type of minimizer package
*/
const std::string & MinimizerType() const { return fMinimizerOpts.MinimizerType(); }
/**
return type of minimizer algorithms
*/
const std::string & MinimizerAlgoType() const { return fMinimizerOpts.MinimizerAlgorithm(); }
/**
flag to check if resulting errors are be normalized according to chi2/ndf
*/
bool NormalizeErrors() const { return fNormErrors; }
///do analysis for parabolic errors
bool ParabErrors() const { return fParabErrors; }
///do minos errros analysis on the parameters
bool MinosErrors() const { return fMinosErrors; }
///Update configuration after a fit using the FitResult
bool UpdateAfterFit() const { return fUpdateAfterFit; }
///Apply Weight correction for error matrix computation
bool UseWeightCorrection() const { return fWeightCorr; }
/// return vector of parameter indeces for which the Minos Error will be computed
const std::vector<unsigned int> & MinosParams() const { return fMinosParams; }
/**
set the option to normalize the error on the result according to chi2/ndf
*/
void SetNormErrors(bool on = true) { fNormErrors= on; }
///set parabolic erros
void SetParabErrors(bool on = true) { fParabErrors = on; }
///set Minos erros computation to be performed after fitting
void SetMinosErrors(bool on = true) { fMinosErrors = on; }
///apply the weight correction for error matric computation
void SetWeightCorrection(bool on = true) { fWeightCorr = on; }
/// set parameter indeces for running Minos
/// this can be used for running Minos on a subset of parameters - otherwise is run on all of them
/// if MinosErrors() is set
void SetMinosErrors(const std::vector<unsigned int> & paramInd ) {
fMinosErrors = true;
fMinosParams = paramInd;
}
///Update configuration after a fit using the FitResult
void SetUpdateAfterFit(bool on = true) { fUpdateAfterFit = on; }
/**
static function to control default minimizer type and algorithm
*/
static void SetDefaultMinimizer(const char * type, const char * algo = 0);
protected:
private:
bool fNormErrors; // flag for error normalization
bool fParabErrors; // get correct parabolic errors estimate (call Hesse after minimizing)
bool fMinosErrors; // do full error analysis using Minos
bool fUpdateAfterFit; // update the configuration after a fit using the result
bool fWeightCorr; // apply correction to errors for weights fits
std::vector<ROOT::Fit::ParameterSettings> fSettings; // vector with the parameter settings
std::vector<unsigned int> fMinosParams; // vector with the parameter indeces for running Minos
ROOT::Math::MinimizerOptions fMinimizerOpts; //minimizer control parameters including name and algo type
};
} // end namespace Fit
} // end namespace ROOT
#endif /* ROOT_Fit_FitConfig */
|