Changeset 7152 for trunk/MagicSoft/Mars/mtools
- Timestamp:
- 06/13/05 10:33:55 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mtools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtools/MChisqEval.cc
r2744 r7152 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // MChisqEval 28 // 29 // Evaluates a chisq from one or two MParameterD calculated in an eventloop. 27 30 // 28 31 ///////////////////////////////////////////////////////////////////////////// … … 30 33 31 34 #include <fstream> 35 36 #include "MLog.h" 37 #include "MLogManip.h" 32 38 33 39 #include "MDataChain.h" … … 40 46 using namespace std; 41 47 42 void MChisqEval::StreamPrimitive(ofstream &out) const 43 { 44 out << " MChisqEval " << GetUniqueName() << ";"; 45 if (fData0) 46 out << " " << GetUniqueName() << ".SetY1(\"" << fData0->GetRule() << "\");" << endl; 47 if (fData1) 48 out << " " << GetUniqueName() << ".SetY1(\"" << fData1->GetRule() << "\");" << endl; 49 } 48 const TString MChisqEval::gsDefName = "MChisqEval"; 49 const TString MChisqEval::gsDefTitle = "Evaluate a chisq"; 50 50 51 MChisqEval::MChisqEval(const char *name, const char *title) : fData0(NULL), fData1(NULL) // : fMatrix(mat), fColumn(col), fEvalE(evale)51 MChisqEval::MChisqEval(const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue") 52 52 { 53 53 fName = name ? name : gsDefName.Data(); … … 55 55 } 56 56 57 MChisqEval::MChisqEval(MData *y1, const char *name, const char *title) : fData0(NULL), fData1(NULL) // : fMatrix(mat), fColumn(col), fEvalE(evale)57 MChisqEval::MChisqEval(MData *y1, const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue") 58 58 { 59 59 fName = name ? name : gsDefName.Data(); … … 62 62 } 63 63 64 MChisqEval::MChisqEval(MData *y1, MData *y2, const char *name, const char *title) : fData0(NULL), fData1(NULL) // : fMatrix(mat), fColumn(col), fEvalE(evale)64 MChisqEval::MChisqEval(MData *y1, MData *y2, const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue") 65 65 { 66 66 fName = name ? name : gsDefName.Data(); … … 123 123 return kFALSE; 124 124 125 fResult = (MParameterD*)plist->FindCreateObj("MParameterD", "MFitResult");125 fResult = (MParameterD*)plist->FindCreateObj("MParameterD", fNameResult); 126 126 if (!fResult) 127 127 return kFALSE; … … 136 136 137 137 const Double_t dy = y2-y1; 138 const Double_t err = fData1 ? y1*y 1: 1;138 const Double_t err = fData1 ? y1*y2 : 1; 139 139 140 140 fChisq += dy*dy/err; … … 144 144 Int_t MChisqEval::PostProcess() 145 145 { 146 fChisq /= GetNumExecutions(); 146 if (GetNumExecutions()>0) 147 fChisq /= GetNumExecutions(); 147 148 148 149 fResult->SetVal(fChisq); 150 151 *fLog << inf << GetDescriptor() << ": Result=" << fChisq << endl; 149 152 150 153 return kTRUE; 151 154 } 152 155 153 const TString MChisqEval::gsDefName = "MChisqEval"; 154 const TString MChisqEval::gsDefTitle = "Evaluate a chisq"; 156 void MChisqEval::StreamPrimitive(ofstream &out) const 157 { 158 out << " MChisqEval " << GetUniqueName() << ";"; 159 if (fData0) 160 out << " " << GetUniqueName() << ".SetY1(\"" << fData0->GetRule() << "\");" << endl; 161 if (fData1) 162 out << " " << GetUniqueName() << ".SetY1(\"" << fData1->GetRule() << "\");" << endl; 163 } 155 164 -
trunk/MagicSoft/Mars/mtools/MChisqEval.h
r2744 r7152 21 21 MData *fData1; // Data Member two (measured data) 22 22 23 // -------------------------------------------------------------------------- 24 // 25 // Implementation of SavePrimitive. Used to write the call to a constructor 26 // to a macro. In the original root implementation it is used to write 27 // gui elements to a macro-file. 28 // 23 TString fNameResult; 24 29 25 void StreamPrimitive(ofstream &out) const; 30 26
Note:
See TracChangeset
for help on using the changeset viewer.