Go to the documentation of this file.
60 result = dynamic_cast<T&>(
object).Fit(tuple.first, tuple.second.c_str(),
"same");
62 catch(
const std::exception&) {}
92 int main(
int argc,
char **argv)
112 JParser<> zap(
"General purpose fit program using ROOT.");
114 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
116 zap[
'F'] =
make_field(formula,
"fit formula, e.g: \"[0]+[1]*x\"");
117 zap[
'@'] =
make_field(startValues,
"start values, e.g: \"p0 = GetMaximum;\"");
118 zap[
'='] =
make_field(fixedValues,
"fixed values, e.g: \"p0 = GetMaximum;\"");
121 zap[
'O'] =
make_field(option,
"Fit option") =
"";
128 catch(
const exception &error) {
129 FATAL(error.what() << endl);
133 if (option.find(
'O') == string::npos) { option +=
"O"; }
135 if (
debug == 0 && option.find(
'Q') == string::npos) { option +=
"Q"; }
141 TF2* fcn =
new TF2(
"user", formula.c_str());
145 if (fcn->IsZombie()) {
146 FATAL(
"Function: " << formula <<
" is zombie." << endl);
151 DEBUG(
"Input: " << *input << endl);
156 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
160 const TRegexp regexp(input->getObjectName());
162 TIter iter(dir->GetListOfKeys());
164 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
166 const TString tag(key->GetName());
168 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
172 if (tag.Contains(regexp)) {
174 TObject*
object = key->ReadObj();
190 FATAL(error << endl);
193 DEBUG(
"Start values " << object->GetName() << endl);
195 for (
int j = 0;
j != fcn->GetNpar(); ++
j) {
196 DEBUG(left << setw(12) << fcn->GetParName (
j) <<
' ' <<
208 if (fit.result != -1) {
212 NOTICE(
"Fit values " << object->GetName() << endl);
213 NOTICE(
"Fit formula " << formula << endl);
215 for (
int j = 0;
j != fcn->GetNpar(); ++
j) {
216 NOTICE(left << setw(12) << fcn->GetParName (
j) <<
' ' <<
217 SCIENTIFIC(12,5) << fcn->GetParameter(
j) <<
" +/- " <<
223 WARNING(
"Object: not compatible with ROOT Fit." << endl);
int main(int argc, char **argv)
int getParameter(const std::string &text)
Get parameter number from text string.
Auxiliary class for a type holder.
Empty structure for specification of parser element that is initialised (i.e.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
Auxiliary data structure for floating point format specification.
JObject_t & for_each(JObject_t &object, JType< JTypeList< JHead_t, JTail_t > > typelist)
For each data type method.
Exception for parsing value.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define DEBUG(A)
Message macros.
Wrapper class around string.
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
Data structure for track fit results.