00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4HistogramStatus.h"
00017
00018 #include <iostream.h>
00019
00020 #include "TH2.h"
00021 #include "TH3.h"
00022
00023 #include "Go4Log/TGo4Log.h"
00024
00025 TGo4HistogramStatus::TGo4HistogramStatus(TH1* his, Bool_t allstatistics)
00026 : TGo4ObjectStatus(his, allstatistics),
00027 fiDim(0),fiNbinX(0), fiNbinY(0), fiNbinZ(0),
00028 fdXmin(0), fdXmax(0), fdYmin(0), fdYmax(0), fdZmin(0), fdZmax(0),
00029 fdEntries(0), fdXmean(0), fdYmean(0), fdZmean(0),
00030 fdXrms(0), fdYrms(0), fdZrms(0)
00031 {
00032 TRACE((14,"TGo4HistogramStatus::TGo4HistogramStatus(TH1*)",__LINE__, __FILE__));
00033
00034 if(his!=0)
00035 {
00036 fiDim=his->GetDimension();
00037 fiNbinX=his->GetNbinsX();
00038 fiNbinY=his->GetNbinsY();
00039 fiNbinZ=his->GetNbinsZ();
00040 TAxis* xax=his->GetXaxis();
00041 if(xax)
00042 {
00043 fdXmin=xax->GetXmin();
00044 fdXmax=xax->GetXmax();
00045 }
00046 else
00047 {
00048 }
00049 TAxis* yax=his->GetYaxis();
00050 if(yax)
00051 {
00052 fdYmin=yax->GetXmin();
00053 fdYmax=yax->GetXmax();
00054 }
00055 else
00056 {
00057 }
00058 TAxis* zax=his->GetZaxis();
00059 if(zax)
00060 {
00061 fdZmin=zax->GetXmin();
00062 fdZmax=zax->GetXmax();
00063 }
00064 else
00065 {
00066 }
00067 fdEntries = his->GetEntries();
00070 Int_t fieldsize=0;
00071
00072
00073 if(his->InheritsFrom("TH1D"))
00074 {
00075 TH1D* dhis=dynamic_cast<TH1D*>(his);
00076 fieldsize=sizeof(Double_t)*dhis->GetSize();
00077 }
00078 else if(his->InheritsFrom("TH1F"))
00079 {
00080 TH1F* fhis=dynamic_cast<TH1F*>(his);
00081 fieldsize=sizeof(Float_t)*fhis->GetSize();
00082 }
00083 else if(his->InheritsFrom("TH1I"))
00084 {
00085 TH1I* ihis=dynamic_cast<TH1I*>(his);
00086 fieldsize=sizeof(Int_t)*ihis->GetSize();
00087 }
00088 else if(his->InheritsFrom("TH1S"))
00089 {
00090 TH1S* shis=dynamic_cast<TH1S*>(his);
00091 fieldsize=sizeof(Short_t)*shis->GetSize();
00092 }
00093 else if(his->InheritsFrom("TH1C"))
00094 {
00095 TH1C* chis=dynamic_cast<TH1C*>(his);
00096 fieldsize=sizeof(Char_t)*chis->GetSize();
00097 }
00098 else if(his->InheritsFrom("TH2D"))
00099 {
00100 TH2D* dhis=dynamic_cast<TH2D*>(his);
00101 fieldsize=sizeof(Double_t)*dhis->GetSize();
00102 }
00103 else if(his->InheritsFrom("TH2F"))
00104 {
00105 TH2F* fhis=dynamic_cast<TH2F*>(his);
00106 fieldsize=sizeof(Float_t)*fhis->GetSize();
00107 }
00108 else if(his->InheritsFrom("TH2I"))
00109 {
00110 TH2I* ihis=dynamic_cast<TH2I*>(his);
00111 fieldsize=sizeof(Int_t)*ihis->GetSize();
00112 }
00113 else if(his->InheritsFrom("TH2S"))
00114 {
00115 TH2S* shis=dynamic_cast<TH2S*>(his);
00116 fieldsize=sizeof(Short_t)*shis->GetSize();
00117 }
00118 else if(his->InheritsFrom("TH2C"))
00119 {
00120 TH2C* chis=dynamic_cast<TH2C*>(his);
00121 fieldsize=sizeof(Char_t)*chis->GetSize();
00122 }
00123 else if(his->InheritsFrom("TH3D"))
00124 {
00125 TH3D* dhis=dynamic_cast<TH3D*>(his);
00126 fieldsize=sizeof(Double_t)*dhis->GetSize();
00127 }
00128 else if(his->InheritsFrom("TH3F"))
00129 {
00130 TH3F* fhis=dynamic_cast<TH3F*>(his);
00131 fieldsize=sizeof(Float_t)*fhis->GetSize();
00132 }
00133 else if(his->InheritsFrom("TH3I"))
00134 {
00135 TH3I* ihis=dynamic_cast<TH3I*>(his);
00136 fieldsize=sizeof(Int_t)*ihis->GetSize();
00137 }
00138 else if(his->InheritsFrom("TH3S"))
00139 {
00140 TH3S* shis=dynamic_cast<TH3S*>(his);
00141 fieldsize=sizeof(Short_t)*shis->GetSize();
00142 }
00143 else if(his->InheritsFrom("TH3C"))
00144 {
00145 TH3C* chis=dynamic_cast<TH3C*>(his);
00146 fieldsize=sizeof(Char_t)*chis->GetSize();
00147 }
00148 fiObjectSize+=fieldsize;
00150
00151 if(allstatistics)
00152 {
00153
00154
00155
00156 fdXmean=his->GetMean(1);
00157 fdYmean=his->GetMean(2);
00158 fdZmean=his->GetMean(3);
00159
00160 fdXrms=his->GetRMS(1);
00161 fdYrms=his->GetRMS(2);
00162 fdZrms=his->GetRMS(3);
00163
00164 }
00165 else
00166 {
00167
00168 }
00169 }
00170 else
00171 {
00172
00173
00174 }
00175 }
00176
00177
00178
00179 TGo4HistogramStatus::TGo4HistogramStatus() : TGo4ObjectStatus(),
00180 fiDim(0),fiNbinX(0), fiNbinY(0), fiNbinZ(0),
00181 fdXmin(0), fdXmax(0), fdYmin(0), fdYmax(0), fdZmin(0), fdZmax(0),
00182 fdEntries(0), fdXmean(0), fdYmean(0), fdZmean(0),
00183 fdXrms(0), fdYrms(0), fdZrms(0)
00184 {
00185 TRACE((14,"TGo4HistogramStatus::TGo4HistogramStatus()",__LINE__, __FILE__));
00186
00187 }
00188
00189
00190 TGo4HistogramStatus::~TGo4HistogramStatus()
00191 {
00192 TRACE((14,"TGo4HistogramStatus::TGo4HistogramStatus()",__LINE__, __FILE__));
00193
00194 }
00195
00196 Int_t TGo4HistogramStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00197 {
00198 TRACE((12,"TGo4HistogramStatus::PrintStatus()",__LINE__, __FILE__));
00199
00200 if(buflen<=0 && buffer!=0)
00201 return 0;
00202 Int_t locallen=128000;
00203 Text_t localbuf[locallen];
00204 Int_t size=0;
00205 Text_t* current=localbuf;
00206 Int_t restlen=locallen;
00207 Int_t delta= TGo4ObjectStatus::PrintStatus(current,restlen);
00208 restlen-=delta;
00209 current+=delta;
00210 current=PrintIndent(current,restlen);
00211 current=PrintBuffer(current,restlen, "G-OOOO-> Histogram Status Class Printout <-OOOO-G\n");
00212 current=PrintIndent(current,restlen);
00213 current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00214
00215 current=PrintIndent(current,restlen);
00216 current=PrintBuffer(current,restlen, " Dimension: \t%d\n",GetDimension());
00217 current=PrintIndent(current,restlen);
00218 current=PrintBuffer(current,restlen, " Bins X: \t%d\n",GetXbins());
00219 current=PrintIndent(current,restlen);
00220 current=PrintBuffer(current,restlen, " X min: \t\t%f\n",GetXmin());
00221 current=PrintIndent(current,restlen);
00222 current=PrintBuffer(current,restlen, " X max: \t\t%f\n",GetXmax());
00223 current=PrintIndent(current,restlen);
00224 current=PrintBuffer(current,restlen, " X mean: \t%f\n",GetXmean());
00225 current=PrintIndent(current,restlen);
00226 current=PrintBuffer(current,restlen, " X rms: \t\t%f\n",GetXrms());
00227 if(GetDimension()>1)
00228 {
00229 current=PrintIndent(current,restlen);
00230 current=PrintBuffer(current,restlen, " Bins Y: \t%d\n",GetYbins());
00231 current=PrintIndent(current,restlen);
00232 current=PrintBuffer(current,restlen, " Y min: \t\t%f\n",GetYmin());
00233 current=PrintIndent(current,restlen);
00234 current=PrintBuffer(current,restlen, " Y max: \t\t%f\n",GetYmax());
00235 current=PrintIndent(current,restlen);
00236 current=PrintBuffer(current,restlen, " Y mean: \t%f\n",GetYmean());
00237 current=PrintIndent(current,restlen);
00238 current=PrintBuffer(current,restlen, " Y rms: \t\t%f\n",GetYrms());
00239 }
00240 else
00241 { }
00242 if(GetDimension()>2)
00243 {
00244 current=PrintIndent(current,restlen);
00245 current=PrintBuffer(current,restlen, " Bins Z: \t%d\n",GetZbins());
00246 current=PrintIndent(current,restlen);
00247 current=PrintBuffer(current,restlen, " Z min: \t\t%f\n",GetZmin());
00248 current=PrintIndent(current,restlen);
00249 current=PrintBuffer(current,restlen, " Z max: \t\t%f\n",GetZmax());
00250 current=PrintIndent(current,restlen);
00251 current=PrintBuffer(current,restlen, " Z mean: \t%f\n",GetZmean());
00252 current=PrintIndent(current,restlen);
00253 current=PrintBuffer(current,restlen, " Z rms: \t\t%f\n",GetZrms());
00254 }
00255 else
00256 { }
00257 current=PrintIndent(current,restlen);
00258 current=PrintBuffer(current,restlen, " N Entries: \t%f\n",GetEntries());
00259 current=PrintIndent(current,restlen);
00260 current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00261 if(buffer==0)
00262 {
00263 cout << localbuf << endl;
00264 }
00265 else
00266 {
00267 size=locallen-restlen;
00268 if(size>buflen-1)
00269 size=buflen-1;
00270 strncpy(buffer,localbuf,size);
00271 }
00272 return size;
00273 }
00274
00275 ClassImp(TGo4HistogramStatus)
00276
00277
00278
00279