00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 enum PropertyIndex
00018 {
00019 HISTITLE,
00020 HISCLASS,
00021 HISENTRIES,
00022 HISX,
00023 HISXSTAT,
00024 HISY,
00025 HISYSTAT,
00026 HISZ,
00027 HISZSTAT,
00028 HISSIZE,
00029 HISTIME
00030 };
00031
00032 void TGo4HistogramInfo::init()
00033 {
00034 setCaption("Histogram Info:");
00035 ResetWidget();
00036 }
00037
00038 void TGo4HistogramInfo::HisPrintButton_clicked()
00039 {
00040 ServiceCall("PrintAnalysisHistograms");
00041 }
00042
00043 void TGo4HistogramInfo::HisDrawButton_clicked()
00044 {
00045 DrawItem(HisnameLbl->text().latin1());
00046 }
00047
00048 void TGo4HistogramInfo::HisInfoButton_clicked()
00049 {
00050 WorkWithHistogram(HisnameLbl->text());
00051 }
00052
00053 bool TGo4HistogramInfo::IsAcceptDrag(const char* itemname, TClass* cl, int kind)
00054 {
00055 return cl==0 ? false : cl->InheritsFrom(TH1::Class());
00056 }
00057
00058 void TGo4HistogramInfo::DropItem(const char* itemname, TClass* cl, int kind)
00059 {
00060 if (cl==0) return;
00061
00062 if (cl->InheritsFrom(TH1::Class()))
00063 WorkWithHistogram(itemname);
00064 }
00065
00066 void TGo4HistogramInfo::linkedObjectUpdated(const char* linkname, TObject* obj)
00067 {
00068 TGo4HistogramStatus* hstate =
00069 dynamic_cast<TGo4HistogramStatus*>(obj);
00070 if (hstate!=0)
00071 RefreshHistogramInfo(hstate);
00072 else
00073 RefreshHistogramInfo(dynamic_cast<TH1*> (obj));
00074 }
00075
00076 void TGo4HistogramInfo::WorkWithHistogram(const char* itemname)
00077 {
00078 ResetWidget();
00079
00080 TGo4BrowserProxy* br = Browser();
00081 if (br==0) return;
00082
00083 HisnameLbl->setText(itemname);
00084
00085 if (br->IsAnalysisItem(itemname)) {
00086 TGo4Slot* tgtslot = AddSlot("HistStatus");
00087 br->RequestObjectStatus(itemname, tgtslot);
00088
00089 AddLink(itemname, "HistogramLock");
00090 } else {
00091 AddLink(itemname, "Histogram");
00092 TH1* h1 = dynamic_cast<TH1*> (GetLinked("Histogram",2));
00093 RefreshHistogramInfo(h1);
00094 }
00095 setFocus();
00096 }
00097
00098 void TGo4HistogramInfo::ResetWidget()
00099 {
00100 QGo4Widget::ResetWidget();
00101
00102 HisnameLbl->setText("");
00103
00104 PropertyBox->changeItem("Title" ,HISTITLE);
00105 PropertyBox->changeItem("Class" ,HISCLASS);
00106 PropertyBox->changeItem("Entries" ,HISENTRIES);
00107 PropertyBox->changeItem("Xrange" ,HISX);
00108 PropertyBox->changeItem("Xstats" ,HISXSTAT);
00109 PropertyBox->changeItem("Yrange" ,HISY);
00110 PropertyBox->changeItem("Ystats" ,HISYSTAT);
00111 PropertyBox->changeItem("Title" ,HISZ);
00112 PropertyBox->changeItem("Zstats" ,HISZSTAT);
00113 PropertyBox->changeItem("Size" ,HISSIZE);
00114 TDatime now;
00115 PropertyBox->changeItem(now.AsSQLString() ,HISTIME);
00116 polish();
00117 update();
00118 show();
00119 raise();
00120 }
00121
00122 void TGo4HistogramInfo::RefreshHistogramInfo(TH1* h1)
00123 {
00124 if (h1==0)
00125 ResetWidget();
00126 else {
00127 TGo4HistogramStatus hstate(h1, kTRUE);
00128 RefreshHistogramInfo(&hstate);
00129 }
00130 }
00131
00132 void TGo4HistogramInfo::RefreshHistogramInfo(TGo4HistogramStatus* hstate)
00133 {
00134 if(hstate==0) return;
00135 TString str;
00136 PropertyBox->changeItem(hstate->GetTitle(), HISTITLE);
00137 PropertyBox->changeItem(hstate->GetObjectClass(), HISCLASS);
00138 str.Form("Entries:%.5g",hstate->GetEntries());
00139 PropertyBox->changeItem(str.Data(), HISENTRIES);
00140 str.Form("X:%d [%.3g,%.3g]",hstate->GetXbins(), hstate->GetXmin(), hstate->GetXmax());
00141 PropertyBox->changeItem(str.Data(), HISX);
00142 str.Form("Xm=%.1f, Xrms=%.1f", hstate->GetXmean(), hstate->GetXrms());
00143 PropertyBox->changeItem(str.Data(), HISXSTAT);
00144
00145 PropertyBox->changeItem("-",HISY);
00146 PropertyBox->changeItem("-",HISYSTAT);
00147 PropertyBox->changeItem("-",HISZ);
00148 PropertyBox->changeItem("-",HISZSTAT);
00149
00150 int dime = hstate->GetDimension();
00151 if(dime>1) {
00152 str.Form("Y:%d [%.3g,%.3g]",hstate->GetYbins(), hstate->GetYmin(), hstate->GetYmax());
00153 PropertyBox->changeItem(str.Data(), HISY);
00154 str.Form("Ym=%.1f, Yrms=%.1f", hstate->GetYmean(), hstate->GetYrms());
00155 PropertyBox->changeItem(str.Data(), HISYSTAT);
00156 }
00157 if(dime>2) {
00158 str.Form("Z:%d [%.3g,%.3g]", hstate->GetZbins(), hstate->GetZmin(), hstate->GetZmax());
00159 PropertyBox->changeItem(str.Data(), HISZ);
00160 str.Form("Zm=%.1f, Zrms=%.1f", hstate->GetZmean(), hstate->GetZrms());
00161 PropertyBox->changeItem(str.Data(), HISZSTAT);
00162 }
00163 str.Form("size:%d b",hstate->GetObjectSize());
00164 PropertyBox->changeItem(str.Data(), HISSIZE);
00165 PropertyBox->changeItem(hstate->GetTimeString(),HISTIME);
00166 polish();
00167 update();
00168 show();
00169 raise();
00170 if(TGo4Log::IsAutoEnabled())
00171 PrintLog_clicked();
00172 }
00173
00174 void TGo4HistogramInfo::PrintLog_clicked()
00175 {
00176 QString textbuffer;
00177 textbuffer="Histogram ";
00178 textbuffer+=HisnameLbl->text();
00179 textbuffer+=" Status: \n ";
00180 textbuffer+="Title: ";
00181 textbuffer+=PropertyBox->item(HISTITLE)->text();
00182 textbuffer+=" Class: ";
00183 textbuffer+=PropertyBox->item(HISCLASS)->text();
00184 textbuffer+=" ";
00185 textbuffer+=PropertyBox->item(HISENTRIES)->text();
00186 textbuffer+="\n ";
00187 textbuffer+=PropertyBox->item(HISX)->text();
00188 textbuffer+=" ";
00189 textbuffer+=PropertyBox->item(HISXSTAT)->text();
00190 textbuffer+="\n ";
00191 textbuffer+=PropertyBox->item(HISY)->text();
00192 textbuffer+=" ";
00193 textbuffer+=PropertyBox->item(HISYSTAT)->text();
00194 textbuffer+="\n ";
00195 textbuffer+=PropertyBox->item(HISZ)->text();
00196 textbuffer+=" ";
00197 textbuffer+=PropertyBox->item(HISZSTAT)->text();
00198 textbuffer+="\n ";
00199 textbuffer+=PropertyBox->item(HISSIZE)->text();
00200 textbuffer+=" Status received at: ";
00201 textbuffer+=PropertyBox->item(HISTIME)->text();
00202 TGo4Log::Message(1,textbuffer.latin1());
00203 }
00204
00205