Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4FitDataHistogram.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4FitDataHistogram.h"
00017 
00018 #include "Riostream.h"
00019 
00020 #include "TH1.h"
00021 #include "TArrayD.h"
00022 #include "TArrayF.h"
00023 
00024 TGo4FitDataHistogram::TGo4FitDataHistogram() :
00025   TGo4FitData(), fxHistogram(this, TH1::Class()) {
00026 }
00027 
00028 TGo4FitDataHistogram::TGo4FitDataHistogram(const char* iName, TH1 *iHistogram, Bool_t iHistogramOwned, Bool_t AddAmpl) :
00029   TGo4FitData(iName,"TH1 and derived classes", dtHistogram, AddAmpl),
00030   fxHistogram("Histogram","Histogram object of TH1 class ",this, TH1::Class(), kTRUE, iHistogram, iHistogramOwned) {
00031 }
00032 
00033 TGo4FitDataHistogram::~TGo4FitDataHistogram() {
00034 }
00035 
00036 void TGo4FitDataHistogram::SetHistogram(TH1 *iHistogram, Bool_t iHistogramOwned)
00037 {
00038    fxHistogram.SetObject(iHistogram,iHistogramOwned);
00039 }
00040 
00041 TGo4FitDataIter* TGo4FitDataHistogram::MakeIter() {
00042    return new TGo4FitDataHistogramIter(this);
00043 }
00044 
00045 void TGo4FitDataHistogram::FillSlotList(TSeqCollection* list) {
00046    TGo4FitData::FillSlotList(list);
00047    list->Add(&fxHistogram);
00048 }
00049 
00050 void TGo4FitDataHistogram::Print(Option_t* option) const {
00051    TGo4FitData::Print(option);
00052    cout << "   ";
00053    fxHistogram.Print(option);
00054 }
00055 
00056 // *********************************************************************************
00057 
00058 
00059 TGo4FitDataHistogramIter::TGo4FitDataHistogramIter() : TGo4FitDataIter(),
00060     fxData(0), fxLimits(), fxOwnScales(), fxOwnWidths() {
00061 }
00062 
00063 TGo4FitDataHistogramIter::TGo4FitDataHistogramIter(TGo4FitDataHistogram* data) :
00064     TGo4FitDataIter(), fxData(data), fxLimits(), fxOwnScales(), fxOwnWidths() {
00065 }
00066 
00067 TGo4FitDataHistogramIter::~TGo4FitDataHistogramIter() {
00068 }
00069 
00070 Bool_t TGo4FitDataHistogramIter::StartReset() {
00071   if (fxData==0) return kFALSE;
00072   TH1* histo = fxData->GetHistogram();
00073   if (histo==0) return kFALSE;
00074 
00075   Int_t NumDimen = histo->GetDimension();
00076   fxLimits.Set(NumDimen);
00077   fxLimits[0] = histo->GetNbinsX();
00078   if (NumDimen>1) fxLimits[1] = histo->GetNbinsY();
00079   if (NumDimen>2) fxLimits[2] = histo->GetNbinsZ();
00080 
00081   fxOwnScales.Set(NumDimen); fxOwnScales.Reset(0.);
00082   fxOwnWidths.Set(NumDimen); fxOwnWidths.Reset(0.);
00083 
00084   return ReserveArrays(NumDimen, NumDimen, kTRUE);
00085 }
00086 
00087 Bool_t TGo4FitDataHistogramIter::ReadCurrentPoint() {
00088   if (fxData==0) return kFALSE;
00089   TH1* histo = fxData->GetHistogram();
00090   if (histo==0) return kFALSE;
00091 
00092   switch (histo->GetDimension()) {
00093      case 1: fdValue = histo->GetBinContent(fxIndexes[0]+1); break;
00094      case 2: fdValue = histo->GetBinContent(fxIndexes[0]+1, fxIndexes[1]+1); break;
00095      case 3: fdValue = histo->GetBinContent(fxIndexes[0]+1, fxIndexes[1]+1, fxIndexes[2]+1); break;
00096      default: fdValue = 0;
00097   }
00098 
00099   if (!GetDeviation()) fdStandardDeviation = fdValue;
00100 
00101   for (Int_t n=0;n<fxOwnScales.GetSize();n++)
00102     switch (n) {
00103       case 0: fxOwnScales[0] = histo->GetXaxis()->GetBinCenter(fxIndexes[0]+1); break;
00104       case 1: fxOwnScales[1] = histo->GetYaxis()->GetBinCenter(fxIndexes[1]+1); break;
00105       case 2: fxOwnScales[2] = histo->GetZaxis()->GetBinCenter(fxIndexes[2]+1); break;
00106     }
00107 
00108   for (Int_t n=0;n<fxOwnWidths.GetSize();n++)
00109     switch (n) {
00110       case 0: fxOwnWidths[0] = histo->GetXaxis()->GetBinWidth(fxIndexes[0]+1); break;
00111       case 1: fxOwnWidths[1] = histo->GetYaxis()->GetBinWidth(fxIndexes[1]+1); break;
00112       case 2: fxOwnWidths[2] = histo->GetZaxis()->GetBinWidth(fxIndexes[2]+1); break;
00113     }
00114 
00115   return ProduceScales(fxIndexes.GetArray(), fxOwnScales.GetArray(), fxOwnWidths.GetArray());
00116 }
00117 
00118 Bool_t TGo4FitDataHistogramIter::ShiftToNextPoint() {
00119   return NextIndex(fxIndexes,fxLimits);
00120 }
00121 
00122 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:12 2008 for Go4-v3.04-1 by  doxygen 1.4.2