GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4FitDataHistogram.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
15
16#include <iostream>
17
18#include "TH1.h"
19
21
22TGo4FitDataHistogram::TGo4FitDataHistogram(const char *iName, TH1 *iHistogram, Bool_t iHistogramOwned, Bool_t AddAmpl)
23 : TGo4FitData(iName, "TH1 and derived classes", dtHistogram, AddAmpl),
24 fxHistogram("Histogram", "Histogram object of TH1 class ", this, TH1::Class(), kTRUE, iHistogram, iHistogramOwned)
25{
26}
27
29
30void TGo4FitDataHistogram::SetHistogram(TH1 *iHistogram, Bool_t iHistogramOwned)
31{
32 fxHistogram.ClearObject();
33 fxHistogram.SetObject(iHistogram, iHistogramOwned);
34}
35
36std::unique_ptr<TGo4FitDataIter> TGo4FitDataHistogram::MakeIter()
37{
38 return std::make_unique<TGo4FitDataHistogramIter>(this);
39}
40
41void TGo4FitDataHistogram::FillSlotList(TSeqCollection *list)
42{
44 list->Add(&fxHistogram);
45}
46
47void TGo4FitDataHistogram::Print(Option_t *option) const
48{
49 TGo4FitData::Print(option);
50 std::cout << " ";
51 fxHistogram.Print(option);
52}
53
54// *********************************************************************************
55
60
65
67
69{
70 if (!fxData)
71 return kFALSE;
72 TH1 *histo = fxData->GetHistogram();
73 if (!histo)
74 return kFALSE;
75
76 Int_t NumDimen = histo->GetDimension();
77 fxLimits.Set(NumDimen);
78 fxLimits[0] = histo->GetNbinsX();
79 if (NumDimen > 1)
80 fxLimits[1] = histo->GetNbinsY();
81 if (NumDimen > 2)
82 fxLimits[2] = histo->GetNbinsZ();
83
84 fxOwnScales.Set(NumDimen);
85 fxOwnScales.Reset(0.);
86 fxOwnWidths.Set(NumDimen);
87 fxOwnWidths.Reset(0.);
88
89 return ReserveArrays(NumDimen, NumDimen, kTRUE);
90}
91
93{
94 if (!fxData)
95 return kFALSE;
96 TH1 *histo = fxData->GetHistogram();
97 if (!histo)
98 return kFALSE;
99
100 switch (histo->GetDimension()) {
101 case 1: fdValue = histo->GetBinContent(fxIndexes[0] + 1); break;
102 case 2: fdValue = histo->GetBinContent(fxIndexes[0] + 1, fxIndexes[1] + 1); break;
103 case 3: fdValue = histo->GetBinContent(fxIndexes[0] + 1, fxIndexes[1] + 1, fxIndexes[2] + 1); break;
104 default: fdValue = 0;
105 }
106
107 if (!GetDeviation())
109
110 for (Int_t n = 0; n < fxOwnScales.GetSize(); n++)
111 switch (n) {
112 case 0: fxOwnScales[0] = histo->GetXaxis()->GetBinCenter(fxIndexes[0] + 1); break;
113 case 1: fxOwnScales[1] = histo->GetYaxis()->GetBinCenter(fxIndexes[1] + 1); break;
114 case 2: fxOwnScales[2] = histo->GetZaxis()->GetBinCenter(fxIndexes[2] + 1); break;
115 }
116
117 for (Int_t n = 0; n < fxOwnWidths.GetSize(); n++)
118 switch (n) {
119 case 0: fxOwnWidths[0] = histo->GetXaxis()->GetBinWidth(fxIndexes[0] + 1); break;
120 case 1: fxOwnWidths[1] = histo->GetYaxis()->GetBinWidth(fxIndexes[1] + 1); break;
121 case 2: fxOwnWidths[2] = histo->GetZaxis()->GetBinWidth(fxIndexes[2] + 1); break;
122 }
123
124 return ProduceScales(fxIndexes.GetArray(), fxOwnScales.GetArray(), fxOwnWidths.GetArray());
125}
126
Bool_t StartReset() override
Reset pointer and other specific values to the beginning of data.
TGo4FitDataHistogram * fxData
Bool_t ReadCurrentPoint() override
Perform specific actions to read all values from data object.
Bool_t ShiftToNextPoint() override
Move pointer to following data point.
Data objects, which provides access to generic TH1 ROOT histogram.
virtual ~TGo4FitDataHistogram()
Destroys TGo4FitDataHistogram object.
void SetHistogram(TH1 *iHistogram, Bool_t iHistogramOwned=kFALSE)
Set histogram to object.
TGo4FitSlot fxHistogram
Slot for storing pointer on TH1 object.
void FillSlotList(TSeqCollection *list) override
Add pointer on slot, which should contains histogram, to list.
TGo4FitDataHistogram()
Default constructor.
void Print(Option_t *option="") const override
Print information to standard output.
std::unique_ptr< TGo4FitDataIter > MakeIter() override
Create TGo4FitDataHistogramIter iterator, associated with given data object.
Double_t fdStandardDeviation
Bool_t ProduceScales(const Int_t *index, const Double_t *ownscales, const Double_t *ownwidths)
Converts scale values.
Bool_t GetDeviation()
Calculates standard deviation from GetSigmaValue() of data object.
Bool_t NextIndex(TArrayI &Index, TArrayI &Limits)
Producing next indexes set according limits values.
TGo4FitDataIter()
Default constructor.
Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth)
Reserve buffers for indexes, scales and width values.
void FillSlotList(TSeqCollection *list) override
Copy pointers on all slots of data object to list.
TGo4FitData()
Default constructor.
void Print(Option_t *option="") const override
Display information about data object on standard output.