TGo4FitDataRidge.cxx

Go to the documentation of this file.
00001 // $Id: TGo4FitDataRidge.cxx 478 2009-10-29 12:26:09Z linev $
00002 //-----------------------------------------------------------------------
00003 //       The GSI Online Offline Object Oriented (Go4) Project
00004 //         Experiment Data Processing at EE department, GSI
00005 //-----------------------------------------------------------------------
00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
00007 //                     Planckstr. 1, 64291 Darmstadt, Germany
00008 // Contact:            http://go4.gsi.de
00009 //-----------------------------------------------------------------------
00010 // This software can be used under the license agreements as stated
00011 // in Go4License.txt file which is part of the distribution.
00012 //-----------------------------------------------------------------------
00013 
00014 #include "TGo4FitDataRidge.h"
00015 
00016 #include "Riostream.h"
00017 
00018 #include "TArrayD.h"
00019 #include "TArrayF.h"
00020 
00021 TGo4FitDataRidge::TGo4FitDataRidge() :
00022   TGo4FitData(), fxData(this, TGo4FitData::Class()), fiSelectedAxis(0) {
00023 }
00024 
00025 TGo4FitDataRidge::TGo4FitDataRidge(const char* iName, TGo4FitData* Data, Int_t SelectedAxis) :
00026   TGo4FitData(iName,"Histogram transform", dtGraph, kFALSE),
00027   fxData("DataForRidge","Data, used to represent bins for ridge",
00028           this, TGo4FitData::Class(), kTRUE, Data, kTRUE),
00029   fiSelectedAxis(SelectedAxis) {
00030     SetExcludeLessThen(-1e50);
00031 }
00032 
00033 TGo4FitDataRidge::~TGo4FitDataRidge() {
00034 }
00035 
00036 
00037 TGo4FitDataIter* TGo4FitDataRidge::MakeIter() {
00038    return new TGo4FitDataRidgeIter(this);
00039 }
00040 
00041 void TGo4FitDataRidge::FillSlotList(TSeqCollection* list) {
00042    TGo4FitData::FillSlotList(list);
00043    list->Add(&fxData);
00044    if (GetData())
00045      GetData()->FillSlotList(list);
00046 }
00047 
00048 void TGo4FitDataRidge::Print(Option_t* option) const {
00049    TGo4FitData::Print(option);
00050    if (GetData())
00051      GetData()->Print(option);
00052    cout << "  selected axis for transform " << fiSelectedAxis << endl;
00053 }
00054 
00055 
00056 // *********************************************************************************
00057 
00058 TGo4FitDataRidgeIter::TGo4FitDataRidgeIter() : TGo4FitDataIter(),
00059     fxData(0), iter(0), fxOwnScales() {
00060 }
00061 
00062 TGo4FitDataRidgeIter::TGo4FitDataRidgeIter(TGo4FitDataRidge* data) :
00063     TGo4FitDataIter(), fxData(data), iter(0), fxOwnScales() {
00064 }
00065 
00066 TGo4FitDataRidgeIter::~TGo4FitDataRidgeIter() {
00067     if (iter!=0) delete iter;
00068 }
00069 
00070 Bool_t TGo4FitDataRidgeIter::StartReset() {
00071   if (iter!=0) { delete iter; iter = 0; }
00072 
00073   if (fxData==0) return kFALSE;
00074   TGo4FitData* data = fxData->GetData();
00075   if (data==0) return kFALSE;
00076 
00077   if (data->GetDataType() != TGo4FitData::dtHistogram ) {
00078      cout << " Only histogramic data can be used for transform " << endl;
00079      return kFALSE;
00080   }
00081 
00082   iter = data->MakeIter();
00083   if ((iter==0) || (!iter->Reset(kTRUE))) return kFALSE;
00084 
00085   fxOwnScales.Set(iter->ScalesSize()-1); fxOwnScales.Reset(0.);
00086 
00087   return ReserveArrays(iter->IndexesSize(), iter->ScalesSize()-1, kFALSE);
00088 }
00089 
00090 Bool_t TGo4FitDataRidgeIter::ReadCurrentPoint() {
00091   if ((iter==0) || (fxData==0)) return kFALSE;
00092 
00093   if (!GetDeviation())
00094    {
00095       if (iter->Value()>0.)
00096          fdStandardDeviation = 1./iter->Value();
00097       else
00098          fdStandardDeviation = 0.;
00099    }
00100   Int_t n1=0;
00101   for (Int_t n=0;n<iter->ScalesSize();n++)
00102     if (n==fxData->GetSelectedAxis()) fdValue = iter->Scales()[n];
00103                                  else fxOwnScales[n1++] = iter->Scales()[n];
00104 
00105   return ProduceScales(iter->Indexes(), fxOwnScales.GetArray(), 0);
00106 }
00107 
00108 Bool_t TGo4FitDataRidgeIter::ShiftToNextPoint() {
00109   if (iter==0) return kFALSE;
00110   Bool_t res = iter->Next(kTRUE);
00111   while (res && (iter->Value()<=0.))
00112     res = iter->Next(kTRUE);
00113   return res;
00114 }
00115 

Generated on Thu Oct 28 15:54:12 2010 for Go4-Fitpackagev4.04-2 by  doxygen 1.5.1