Ignore:
Timestamp:
06/13/05 10:33:55 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtools/MChisqEval.cc

    r2744 r7152  
    2525/////////////////////////////////////////////////////////////////////////////
    2626//
     27// MChisqEval
     28//
     29// Evaluates a chisq from one or two MParameterD calculated in an eventloop.
    2730//
    2831/////////////////////////////////////////////////////////////////////////////
     
    3033
    3134#include <fstream>
     35
     36#include "MLog.h"
     37#include "MLogManip.h"
    3238
    3339#include "MDataChain.h"
     
    4046using namespace std;
    4147
    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 }
     48const TString MChisqEval::gsDefName  = "MChisqEval";
     49const TString MChisqEval::gsDefTitle = "Evaluate a chisq";
    5050
    51 MChisqEval::MChisqEval(const char *name, const char *title) : fData0(NULL), fData1(NULL)// : fMatrix(mat), fColumn(col), fEvalE(evale)
     51MChisqEval::MChisqEval(const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue")
    5252{
    5353    fName  = name  ? name  : gsDefName.Data();
     
    5555}
    5656
    57 MChisqEval::MChisqEval(MData *y1, const char *name, const char *title) : fData0(NULL), fData1(NULL)// : fMatrix(mat), fColumn(col), fEvalE(evale)
     57MChisqEval::MChisqEval(MData *y1, const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue")
    5858{
    5959    fName  = name  ? name  : gsDefName.Data();
     
    6262}
    6363
    64 MChisqEval::MChisqEval(MData *y1, MData *y2, const char *name, const char *title) : fData0(NULL), fData1(NULL)// : fMatrix(mat), fColumn(col), fEvalE(evale)
     64MChisqEval::MChisqEval(MData *y1, MData *y2, const char *name, const char *title) : fData0(NULL), fData1(NULL), fNameResult("MinimizationValue")
    6565{
    6666    fName  = name  ? name  : gsDefName.Data();
     
    123123            return kFALSE;
    124124
    125     fResult = (MParameterD*)plist->FindCreateObj("MParameterD", "MFitResult");
     125    fResult = (MParameterD*)plist->FindCreateObj("MParameterD", fNameResult);
    126126    if (!fResult)
    127127        return kFALSE;
     
    136136
    137137    const Double_t dy  = y2-y1;
    138     const Double_t err = fData1 ? y1*y1 : 1;
     138    const Double_t err = fData1 ? y1*y2 : 1;
    139139
    140140    fChisq += dy*dy/err;
     
    144144Int_t MChisqEval::PostProcess()
    145145{
    146     fChisq /= GetNumExecutions();
     146    if (GetNumExecutions()>0)
     147        fChisq /= GetNumExecutions();
    147148
    148149    fResult->SetVal(fChisq);
     150
     151    *fLog << inf << GetDescriptor() << ": Result=" << fChisq << endl;
    149152
    150153    return kTRUE;
    151154}
    152155
    153 const TString MChisqEval::gsDefName  = "MChisqEval";
    154 const TString MChisqEval::gsDefTitle = "Evaluate a chisq";
     156void 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}
    155164
  • trunk/MagicSoft/Mars/mtools/MChisqEval.h

    r2744 r7152  
    2121    MData   *fData1; // Data Member two (measured data)
    2222
    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
    2925    void StreamPrimitive(ofstream &out) const;
    3026
Note: See TracChangeset for help on using the changeset viewer.