Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4Fit/TGo4FitDataHistogram.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 <iostream.h>
00019 
00020 #include "TArrayD.h"
00021 #include "TArrayF.h"
00022 
00023 TGo4FitDataHistogram::TGo4FitDataHistogram() :
00024   TGo4FitData(), fxHistogram(this, TH1::Class()) {
00025 }
00026 
00027 TGo4FitDataHistogram::TGo4FitDataHistogram(const char* iName, TH1 *iHistogram, Bool_t iHistogramOwned, Bool_t AddAmpl) :
00028   TGo4FitData(iName,"TH1 and derived classes", dtHistogram, AddAmpl),
00029   fxHistogram("Histogram","Histogram object of TH1 class ",this, TH1::Class(), kTRUE, iHistogram, iHistogramOwned) {
00030 }
00031 
00032 TGo4FitDataHistogram::~TGo4FitDataHistogram() {
00033 }
00034 
00035 TGo4FitDataIter* TGo4FitDataHistogram::MakeIter() {
00036    return new TGo4FitDataHistogramIter(this);
00037 }
00038 
00039 void TGo4FitDataHistogram::FillSlotList(TSeqCollection* list) {
00040    TGo4FitData::FillSlotList(list);
00041    list->Add(&fxHistogram);
00042 }
00043 
00044 void TGo4FitDataHistogram::Print(Option_t* option) const {
00045    TGo4FitData::Print(option);
00046    cout << "   ";
00047    fxHistogram.Print(option);
00048 }
00049 
00050 ClassImp(TGo4FitDataHistogram)
00051 
00052 
00053 // *********************************************************************************
00054 
00055 
00056 TGo4FitDataHistogramIter::TGo4FitDataHistogramIter() : TGo4FitDataIter(),
00057     fxData(0), fxLimits(), fxOwnScales(), fxOwnWidths() {
00058 }
00059 
00060 TGo4FitDataHistogramIter::TGo4FitDataHistogramIter(TGo4FitDataHistogram* data) :
00061     TGo4FitDataIter(), fxData(data), fxLimits(), fxOwnScales(), fxOwnWidths() {
00062 }
00063 
00064 TGo4FitDataHistogramIter::~TGo4FitDataHistogramIter() {
00065 }
00066 
00067 Bool_t TGo4FitDataHistogramIter::StartReset() {
00068   if (fxData==0) return kFALSE;
00069   TH1* histo = fxData->GetHistogram();
00070   if (histo==0) return kFALSE;
00071 
00072   Int_t NumDimen = histo->GetDimension();
00073   fxLimits.Set(NumDimen);
00074   fxLimits[0] = histo->GetNbinsX();
00075   if (NumDimen>1) fxLimits[1] = histo->GetNbinsY();
00076   if (NumDimen>2) fxLimits[2] = histo->GetNbinsZ();
00077 
00078   fxOwnScales.Set(NumDimen); fxOwnScales.Reset(0.);
00079   fxOwnWidths.Set(NumDimen); fxOwnWidths.Reset(0.);
00080 
00081   return ReserveArrays(NumDimen, NumDimen, kTRUE);
00082 }
00083 
00084 Bool_t TGo4FitDataHistogramIter::ReadCurrentPoint() {
00085   if (fxData==0) return kFALSE;
00086   TH1* histo = fxData->GetHistogram();
00087   if (histo==0) return kFALSE;
00088 
00089   switch (histo->GetDimension()) {
00090      case 1: fdValue = histo->GetBinContent(fxIndexes[0]+1); break;
00091      case 2: fdValue = histo->GetBinContent(fxIndexes[0]+1, fxIndexes[1]+1); break;
00092      case 3: fdValue = histo->GetBinContent(fxIndexes[0]+1, fxIndexes[1]+1, fxIndexes[2]+1); break;
00093      default: fdValue = 0;
00094   }
00095 
00096   if (!GetDeviation()) fdStandardDeviation = fdValue;
00097 
00098   for (Int_t n=0;n<fxOwnScales.GetSize();n++)
00099     switch (n) {
00100       case 0: fxOwnScales[0] = histo->GetXaxis()->GetBinCenter(fxIndexes[0]+1); break;
00101       case 1: fxOwnScales[1] = histo->GetYaxis()->GetBinCenter(fxIndexes[1]+1); break;
00102       case 2: fxOwnScales[2] = histo->GetZaxis()->GetBinCenter(fxIndexes[2]+1); break;
00103     }
00104 
00105   for (Int_t n=0;n<fxOwnWidths.GetSize();n++)
00106     switch (n) {
00107       case 0: fxOwnWidths[0] = histo->GetXaxis()->GetBinWidth(fxIndexes[0]+1); break;
00108       case 1: fxOwnWidths[1] = histo->GetYaxis()->GetBinWidth(fxIndexes[1]+1); break;
00109       case 2: fxOwnWidths[2] = histo->GetZaxis()->GetBinWidth(fxIndexes[2]+1); break;
00110     }
00111 
00112   return ProduceScales(fxIndexes.GetArray(), fxOwnScales.GetArray(), fxOwnWidths.GetArray());
00113 }
00114 
00115 Bool_t TGo4FitDataHistogramIter::ShiftToNextPoint() {
00116   return NextIndex(fxIndexes,fxLimits);
00117 }
00118 
00119 ClassImp(TGo4FitDataHistogramIter)
00120 
00121 
00122 
00123 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:55:56 2005 for Go4-v2.10-5 by doxygen1.2.15