GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4FitDataRidge.cxx
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4FitDataRidge.h"
15 
16 #include <iostream>
17 
18 TGo4FitDataRidge::TGo4FitDataRidge() : TGo4FitData(), fxData(this, TGo4FitData::Class()), fiSelectedAxis(0) {}
19 
20 TGo4FitDataRidge::TGo4FitDataRidge(const char *iName, TGo4FitData *Data, Int_t SelectedAxis)
21  : TGo4FitData(iName, "Histogram transform", dtGraph, kFALSE),
22  fxData("DataForRidge", "Data, used to represent bins for ridge", this, TGo4FitData::Class(), kTRUE, Data, kTRUE),
23  fiSelectedAxis(SelectedAxis)
24 {
25  SetExcludeLessThen(-1e50);
26 }
27 
29 
30 std::unique_ptr<TGo4FitDataIter> TGo4FitDataRidge::MakeIter()
31 {
32  return std::make_unique<TGo4FitDataRidgeIter>(this);
33 }
34 
35 void TGo4FitDataRidge::FillSlotList(TSeqCollection *list)
36 {
38  list->Add(&fxData);
39  if (GetData())
40  GetData()->FillSlotList(list);
41 }
42 
43 void TGo4FitDataRidge::Print(Option_t *option) const
44 {
45  TGo4FitData::Print(option);
46  if (GetData())
47  GetData()->Print(option);
48  std::cout << " selected axis for transform " << fiSelectedAxis << std::endl;
49 }
50 
51 // *********************************************************************************
52 
53 TGo4FitDataRidgeIter::TGo4FitDataRidgeIter() : TGo4FitDataIter(), fxData(nullptr), iter(), fxOwnScales() {}
54 
56  : TGo4FitDataIter(), fxData(data), iter(), fxOwnScales()
57 {
58 }
59 
61 {
62 }
63 
65 {
66  iter.reset();
67 
68  if (!fxData)
69  return kFALSE;
70 
71  TGo4FitData *data = fxData->GetData();
72  if (!data)
73  return kFALSE;
74 
75  if (data->GetDataType() != TGo4FitData::dtHistogram) {
76  std::cout << " Only histogramic data can be used for transform " << std::endl;
77  return kFALSE;
78  }
79 
80  iter = data->MakeIter();
81  if (!iter || !iter->Reset(kTRUE))
82  return kFALSE;
83 
84  fxOwnScales.Set(iter->ScalesSize() - 1);
85  fxOwnScales.Reset(0.);
86 
87  return ReserveArrays(iter->IndexesSize(), iter->ScalesSize() - 1, kFALSE);
88 }
89 
91 {
92  if (!iter || !fxData)
93  return kFALSE;
94 
95  if (!GetDeviation()) {
96  if (iter->Value() > 0.)
97  fdStandardDeviation = 1. / iter->Value();
98  else
100  }
101  Int_t n1 = 0;
102  for (Int_t n = 0; n < iter->ScalesSize(); n++)
103  if (n == fxData->GetSelectedAxis())
104  fdValue = iter->Scales()[n];
105  else
106  fxOwnScales[n1++] = iter->Scales()[n];
107 
108  return ProduceScales(iter->Indexes(), fxOwnScales.GetArray(), nullptr);
109 }
110 
112 {
113  if (!iter)
114  return kFALSE;
115  Bool_t res = iter->Next(kTRUE);
116  while (res && (iter->Value() <= 0.))
117  res = iter->Next(kTRUE);
118  return res;
119 }
virtual ~TGo4FitDataRidge()
TGo4FitSlot fxData
Bool_t ProduceScales(const Int_t *index, const Double_t *ownscales, const Double_t *ownwidths)
Double_t fdStandardDeviation
Definition: TGo4FitData.h:617
void Print(Option_t *option="") const override
TGo4FitDataRidge * fxData
Double_t fdValue
Definition: TGo4FitData.h:616
virtual void Print(Option_t *option="") const override
void SetExcludeLessThen(Double_t limit=0.)
Definition: TGo4FitData.h:117
std::unique_ptr< TGo4FitDataIter > MakeIter() override
Bool_t ReadCurrentPoint() override
Int_t GetSelectedAxis() const
std::unique_ptr< TGo4FitDataIter > iter
TGo4FitData * GetData() const
void FillSlotList(TSeqCollection *list) override
Bool_t StartReset() override
Bool_t ShiftToNextPoint() override
Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth)
void FillSlotList(TSeqCollection *list) override
virtual std::unique_ptr< TGo4FitDataIter > MakeIter()
Definition: TGo4FitData.h:175
Bool_t GetDeviation()
Int_t GetDataType() const
Definition: TGo4FitData.h:63