GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4HistogramStatus.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 "TGo4HistogramStatus.h"
15
16#include "TH1.h"
17#include "TH2.h"
18#include "TH3.h"
19
20#include "TGo4Log.h"
21
25
26TGo4HistogramStatus::TGo4HistogramStatus(TH1 *his, Bool_t allstatistics)
27 : TGo4ObjectStatus(his, allstatistics)
28
29{
30 GO4TRACE((14,"TGo4HistogramStatus::TGo4HistogramStatus(TH1 *)",__LINE__, __FILE__));
31
32 if (his) {
33 fiDim = his->GetDimension();
34 fiNbinX = his->GetNbinsX();
35 fiNbinY = his->GetNbinsY();
36 fiNbinZ = his->GetNbinsZ();
37 TAxis *xax = his->GetXaxis();
38 if (xax) {
39 fdXmin = xax->GetXmin();
40 fdXmax = xax->GetXmax();
41 } else { // values already initialized as zero
42 }
43 TAxis *yax = his->GetYaxis();
44 if (yax) {
45 fdYmin = yax->GetXmin();
46 fdYmax = yax->GetXmax();
47 } else { // values already initialized as zero
48 }
49 TAxis *zax = his->GetZaxis();
50 if (zax) {
51 fdZmin = zax->GetXmin();
52 fdZmax = zax->GetXmax();
53 } else { // values already initialized as zero
54 }
55 fdEntries = his->GetEntries();
58 Int_t fieldsize = 4; // use as default bin size 4 bytes
59 // because of multiple inheritance of histogram types, we
60 // must check for all types separately to downcast the correct TArray:
61 if (his->InheritsFrom(TH1D::Class()) || his->InheritsFrom(TH2D::Class()) || his->InheritsFrom(TH3D::Class())) {
62 fieldsize = sizeof(Double_t);
63 } else if (his->InheritsFrom(TH1F::Class()) || his->InheritsFrom(TH2F::Class()) || his->InheritsFrom(TH3F::Class())) {
64 fieldsize = sizeof(Float_t);
65 } else if (his->InheritsFrom(TH1I::Class()) || his->InheritsFrom(TH2I::Class()) || his->InheritsFrom(TH3I::Class())) {
66 fieldsize = sizeof(Int_t);
67 } else if (his->InheritsFrom(TH1S::Class()) || his->InheritsFrom(TH2S::Class()) || his->InheritsFrom(TH3S::Class())) {
68 fieldsize = sizeof(Short_t);
69 } else if (his->InheritsFrom(TH1C::Class()) || his->InheritsFrom(TH2C::Class()) || his->InheritsFrom(TH3C::Class())) {
70 fieldsize = sizeof(Char_t);
71 }
72
73#if ROOT_VERSION_CODE > ROOT_VERSION(6,32,0)
74 else if (his->InheritsFrom(TH1L::Class()) || his->InheritsFrom(TH2L::Class()) || his->InheritsFrom(TH3L::Class())) {
75 fieldsize = sizeof(Long64_t);
76 }
77#endif
78
79 fiObjectSize += fieldsize * his->GetNcells(); // add heap field to object stack memory size
81
82 if (allstatistics) {
83 // note: we do not calculate statistic for nameslist
84 // slows down when processing empty 2d histos!
85 fdXmean = his->GetMean(1);
86 fdYmean = his->GetMean(2);
87 fdZmean = his->GetMean(3);
88 fdXrms = his->GetRMS(1);
89 fdYrms = his->GetRMS(2);
90 fdZrms = his->GetRMS(3);
91 }
92 }
93}
94
95
97{
98 GO4TRACE((14,"TGo4HistogramStatus::TGo4HistogramStatus()",__LINE__, __FILE__));
99}
100
101void TGo4HistogramStatus::Print(Option_t *) const
102{
104 PrintLine("G-OOOO-> Histogram Status Class Printout <-OOOO-G");
105 PrintLine("G-OOOO-> ---------------------------------------------- <-OOOO-G");
106 // put printout of histogram infos here:
107 PrintLine(" Dimension: \t%d", GetDimension());
108 PrintLine(" Bins X: \t%d", GetXbins());
109 PrintLine(" X min: \t\t%f", GetXmin());
110 PrintLine(" X max: \t\t%f", GetXmax());
111 PrintLine(" X mean: \t%f", GetXmean());
112 PrintLine(" X rms: \t\t%f", GetXrms());
113 if (GetDimension() > 1) {
114 PrintLine(" Bins Y: \t%d", GetYbins());
115 PrintLine(" Y min: \t\t%f", GetYmin());
116 PrintLine(" Y max: \t\t%f", GetYmax());
117 PrintLine(" Y mean: \t%f", GetYmean());
118 PrintLine(" Y rms: \t\t%f", GetYrms());
119 }
120 if (GetDimension() > 2) {
121 PrintLine(" Bins Z: \t%d", GetZbins());
122 PrintLine(" Z min: \t\t%f", GetZmin());
123 PrintLine(" Z max: \t\t%f", GetZmax());
124 PrintLine(" Z mean: \t%f", GetZmean());
125 PrintLine(" Z rms: \t\t%f", GetZrms());
126 }
127 PrintLine(" N Entries: \t%f", GetEntries());
128}
#define GO4TRACE(X)
Definition TGo4Log.h:25
Axis_t fdXmax
Upper edge of x axis.
Axis_t fdZmax
Upper edge of z axis.
Axis_t fdXmin
Lower edge of x axis.
Stat_t fdXmean
Mean value in x projection.
Axis_t fdZmin
Lower edge of z axis.
Stat_t fdZrms
Root mean square value in z projection.
Int_t fiNbinX
Number of bins in x axis.
void Print(Option_t *opt="") const override
Axis_t fdYmin
Lower edge of y axis.
Int_t fiNbinY
Number of bins in y axis.
Stat_t fdEntries
Number of filled entries.
Stat_t fdZmean
Mean value in z projection.
Int_t fiNbinZ
Number of bins in z axis.
Axis_t fdYmax
Upper edge of y axis.
Stat_t fdXrms
Root mean square value in x projection.
Stat_t fdYrms
Root mean square value in y projection.
Stat_t fdYmean
Mean value in y projection.
Int_t fiDim
Histogram dimension (1,2,3).
UInt_t fiObjectSize
Size of the described object in byte.
TGo4ObjectStatus()
default ctor for streamer.
void Print(Option_t *opt="") const override
static void PrintLine(const char *text,...)
Print single line of debug output with appropriate indent.