27 #include "TGraphErrors.h"
28 #include "TGraphAsymmErrors.h"
29 #include "TMultiGraph.h"
32 #include "TDirectory.h"
40 #include "TObjString.h"
42 #include "TObjectTable.h"
46 #include "TGo4LockGuard.h"
72 #include "TVirtualTreePlayer.h"
85 if ((slot!=0) && (obj!=0))
91 virtual Bool_t
Use()
const {
return kFALSE; }
97 Bool_t updatedone =
false;
100 if ((
fObject->IsA()==obj->IsA()) &&
101 (strcmp(
fObject->GetName(), obj->GetName())==0))
109 if (owner)
delete obj;
119 if ((
fObject==0) && !strong)
return;
126 if (browser!=0)
break;
141 fbWithRootBrowser(kFALSE),
145 fiMonitoringPeriod(0),
147 fbBlockMonitoring(kFALSE),
158 const char* viewpath,
159 Bool_t withRootBrowser) :
161 fxDataPath(datapath),
163 fxViewPath(viewpath),
164 fbWithRootBrowser(withRootBrowser),
165 fxMemoryPath(
"Workspace"),
168 fiMonitoringPeriod(0),
170 fbBlockMonitoring(kFALSE),
182 if (gDebug>1) Info(
"~TGo4BrowserProxy",
"Called");
207 if (gDebug>1) Info(
"~TGo4BrowserProxy",
"Finished");
217 gROOT->GetClass(
"TH1");
218 gROOT->GetClass(
"TH1C");
219 gROOT->GetClass(
"TH1D");
220 gROOT->GetClass(
"TH1F");
221 gROOT->GetClass(
"TH1I");
222 gROOT->GetClass(
"TH1S");
223 gROOT->GetClass(
"TH2");
224 gROOT->GetClass(
"TH2C");
225 gROOT->GetClass(
"TH2D");
226 gROOT->GetClass(
"TH2F");
227 gROOT->GetClass(
"TH2I");
228 gROOT->GetClass(
"TH2S");
229 gROOT->GetClass(
"TH3");
230 gROOT->GetClass(
"TH3C");
231 gROOT->GetClass(
"TH3D");
232 gROOT->GetClass(
"TH3F");
233 gROOT->GetClass(
"TH3I");
234 gROOT->GetClass(
"TH3S");
236 gROOT->GetClass(
"TGo4WinCond");
237 gROOT->GetClass(
"TGo4PolyCond");
238 gROOT->GetClass(
"TGo4ShapedCond");
239 gROOT->GetClass(
"TGo4CondArray");
241 gROOT->GetClass(
"TGo4Fitter");
242 gROOT->GetClass(
"TGo4Parameter");
243 gROOT->GetClass(
"TGo4Picture");
245 gROOT->GetClass(
"TGo4DynamicEntry");
246 gROOT->GetClass(
"TGo4HistogramEntry");
247 gROOT->GetClass(
"TGo4TreeHistogramEntry");
248 gROOT->GetClass(
"TLatex");
249 gROOT->GetClass(
"TF1");
250 gROOT->GetClass(
"TGo4AnalysisStatus");
268 bool ischildevent = source->
IsParent(slot);
272 if ((source!=slot) && !ischildevent) {
286 if ((source!=slot) && ischildevent) {
356 if ((cl==0) || !cl->IsLoaded())
return 0;
384 if (itemslot==0)
return kFALSE;
389 if (itemslot->
IsParent(memslot) && (tgtpath==0))
return kFALSE;
392 if (tgtslot==0)
return kFALSE;
393 if ((tgtslot==itemslot) || tgtslot->
IsParent(itemslot))
return kFALSE;
399 for (Int_t n=0;n<itemslot->
NumChilds();n++)
406 if (tgtslot==0)
return kFALSE;
407 if (tgtslot->
GetSlot(itemslot->GetName(), kTRUE)==0)
return kFALSE;
414 subpath += itemslot->GetName();
416 tgtpath = subpath.Data();
419 for (Int_t n=0;n<=childs.GetLast();n++) {
432 if (tgtslot==0)
return kFALSE;
433 if (!tgtslot->
IsParent(memslot) && (tgtslot!=memslot))
return kFALSE;
434 if (itemslot->
GetParent()==tgtslot)
return kFALSE;
435 if (memslot!=tgtslot)
443 if ((obj==0) || forcerequest) {
445 if (res==0)
return kFALSE;
447 if ((res==1) || !forcerequest)
452 TString res =
SaveToMemory(pathname, obj->Clone(), kTRUE);
453 return res.Length()>0;
477 if (itemslot==0)
return;
483 if (slot==0)
continue;
484 if (itemslot->
IsParent(slot))
return;
487 fxClipboard->Add(
new TNamed(itemname,
"clipboard item"));
505 if ((fname==0) || (*fname==0))
return;
521 if ((nodename==0) || (*nodename==0))
return kFALSE;
524 if (!proxy->
Connect(nodename)) {
529 const char* slotname = nodename;
530 if (strncmp(slotname,
"dabc://",7)==0) slotname+=7;
540 const char* basename,
541 const char* userpass,
555 TString capt =
"HServ_";
558 AddServerProxy(hserv, capt.Data(),
"Connection to histogram server");
576 if ((pr!=0) && pr->
IsFile())
591 if (pr!=0) arr->Add(pr);
605 if (pr!=0) arr->Add(pr);
622 (strncmp(pr->
GetServerName(),
"https://",8)==0)) arr->Add(pr);
639 TString& createdhistoname)
641 if (strlen(Xexp)==0)
return;
643 TString varexp(Xexp);
646 varexp = TString(Yexp) + TString(
":") + varexp;
648 varexp = TString(Zexp) + TString(
":") + varexp;
651 int drawdim = varexp.CountChar(
':') + 1;
652 if (drawdim>3) drawdim = 3;
659 TString analhname(hname);
662 TString anitem =
"abcdef";
663 if (analhname.Length()==0)
664 while (anitem.Length()>0) {
665 analhname =
"hTreeDraw";
666 if (cnt>0) { analhname+=
"_"; analhname+=cnt; }
671 an->
RemoteTreeDraw(objname.Data(), varexp.Data(), cutcond, analhname.Data());
675 createdhistoname =
"";
682 TString treeslotname;
684 TTree* SelectedTree =
dynamic_cast<TTree*
> (
fxOM->
GetObject(treeslotname.Data()));
685 if (SelectedTree==0)
return;
687 TString histoname(hname), hslotname;
695 if ((histo!=0) && (drawdim!=histo->GetDimension())) {
703 if ((histo==0) && (histoname.Length()==0))
706 histoname +=
"/hTreeDraw_";
712 TString hfoldername, hobjectname;
716 hobjectname = histo->GetName();
719 varexp += hobjectname;
721 TDirectory* oldhisdir = histo ? histo->GetDirectory() : 0;
722 TDirectory* savdir = gDirectory;
724 TDirectory dummydir(
"DummyTreeDraw",
"Dummy directory to call tree draw");
727 histo->SetDirectory(&dummydir);
729 SelectedTree->Draw(varexp, cutcond,
"goff", 10000000, 0);
732 histo =
dynamic_cast<TH1*
> (dummydir.FindObject(hobjectname));
734 histo->SetDirectory(0);
740 histo->SetDirectory(oldhisdir);
747 #if ROOT_VERSION_CODE < ROOT_VERSION(5,13,1)
769 while (iter.
next()) {
772 if (slot==0)
continue;
776 if ((serv==0) || ((kind==1) && !serv->
IsGo4Analysis()))
continue;
778 if (dynamic_cast<TGo4AnalysisProxy*>(slot->
GetProxy())==0)
continue;
785 if ((res!=0) && !databranch) {
800 if ((slot==0) || (itemname==0))
814 if ((slot==0) || (itemname==0))
823 if ((analslot==0) || (objname==0))
return TString(
"");
826 while (iter.
next()) {
827 if (strcmp(iter.
getname(), objname)!=0)
continue;
841 if ((topslot==0) || (objname==0))
return TString(
"");
845 if (strcmp(iter.
getname(), objname)==0)
854 if (slot==0)
return 0;
858 if (pr!=0)
return pr;
869 const char* objectname = 0;
875 if (serv==0)
return 0;
877 if (objname!=0) *objname = objectname;
889 if (slot==0)
return kFALSE;
892 if (obj==0)
return kFALSE;
894 const char* analysisname = 0;
900 anslot =
fxOM->
FindSlot(slotname.Data(), &analysisname);
918 if (itemslot==0)
return;
924 while (iter.
next()) {
930 if (wait_time==0)
return;
954 if (guislot==0)
return 0;
958 if ((update==0) || ((update==1) && (obj!=0)))
return obj;
991 if (itemslot->
GetPar(
"::CopyObject")!=0) {
1029 if (slot==0)
return kFALSE;
1032 while (treeslot!=0) {
1034 if ((cl!=0) && (cl->InheritsFrom(TTree::Class())))
break;
1037 if (treeslot==0)
return kFALSE;
1046 if ((itemname==0) || (treename==0))
return kFALSE;
1051 if (slot==0)
return kFALSE;
1053 printf(
"DefineLeafName %s %s kind :%d\n", itemname, treename,
ItemKind(slot));
1057 int ilen = strlen(itemname);
1058 int tlen = strlen(treename);
1059 if ((ilen<tlen) || (strncmp(itemname, treename, tlen)!=0))
return kFALSE;
1061 leafname = slot->GetName();
1067 if ((objname==0) || (*objname==0))
return kFALSE;
1070 objectitem = objname;
1082 if (*objname!=
'/') searchname+=
"/";
1083 searchname+=objname;
1090 searchname.Append(
";1");
1095 objectitem = searchname;
1103 if (strchr(objname,
'/')!=0) {
1105 if ((mask & 2) == 0)
return kFALSE;
1111 const char *slash = strchr(objname,
'/');
1113 while (slash != 0) {
1114 slash = strchr(slash+1,
'/');
1115 if (slash == 0)
break;
1118 if (!
DefineRelatedObject(itemname, TString(objname, slash-objname).Data(), diritem, 0))
break;
1120 int kind =
ItemKind(diritem.Data());
1132 if ((mask & 1) == 0)
return kFALSE;
1138 size_t len = strlen(objname);
1139 while (iter.
next()) {
1140 const char* name = iter.
getname();
1142 if (strncmp(objname, name, len)!=0)
continue;
1144 if ((strlen(name) == len) ||
1145 ((strlen(name)==(len+2)) && (strcmp(name+len,
";1")==0))) {
1153 }
while (searchslot!=0);
1161 if (slot==0)
return kFALSE;
1167 if ((cl!=0) && (cl->InheritsFrom(TFile::Class())))
break;
1175 *filepath = itemname + fitemname.Length();
1176 if (**filepath==
'/') (*filepath)++;
1187 if (slot==0)
return kFALSE;
1190 if (obj==0)
return kFALSE;
1193 if (fileslot==0)
return kFALSE;
1196 if (dircont==0)
return kFALSE;
1209 if (slot==0)
return kFALSE;
1212 if (obj==0)
return kFALSE;
1214 TFile* f = TFile::Open(filename,
"UPDATE");
1215 if (f==0)
return kFALSE;
1217 TDirectory* dir = f;
1219 if ((subfolder!=0) && (*subfolder!=0)) {
1220 dir =
dynamic_cast<TDirectory*
> (f->Get(subfolder));
1221 if (dir==0) dir = f;
1225 bool res = dir->WriteTObject(obj, obj->GetName(),
"Overwrite") > 0;
1227 if (obj->InheritsFrom(TH1::Class()))
1228 ((TH1*) obj)->SetDirectory(0);
1237 const char* filename,
1238 const char* filedir,
1240 const char* description)
1242 if ((items==0) || (items->GetSize()==0))
return;
1251 if(convert.Contains(
"ASCII")) {
1255 if (convert.Contains(
"Radware")) {
1259 if (convert.Contains(
"ROOT XML")) {
1263 if (convert.Contains(
"ROOT")) {
1273 TObjString* str =
dynamic_cast<TObjString*
> (items->At(0));
1277 TString fname = filename;
1280 if(!fname.Contains(
".xml")) fname.Append(
".xml");
1282 if(!fname.Contains(
".root")) fname.Append(
".root");
1285 if ((itemslot!=0) && (itemslot->
NumChilds()>0)) {
1297 TGo4Log::Message(1,
"Exporting selected browser objects to %s",convert.Data());
1300 for (
int n=0;n<=items->GetLast();n++) {
1301 TObjString* str =
dynamic_cast<TObjString*
> (items->At(n));
1302 if (str==0)
continue;
1307 if (obj!=0) objs.Add(obj);
1310 exman.
Export(&objs, filter);
1315 const char* selectedpath,
1316 const char* description)
1320 if (toppath==0)
return kFALSE;
1325 TFile* f = TFile::Open(filename,
"recreate", description);
1326 if (f==0)
return kFALSE;
1342 if (slot==0)
return kFALSE;
1344 if (!slot->
GetIntPar(
"GUI::Remote", remote))
return kFALSE;
1350 TString analysisname;
1356 if ((stime!=0) && (sdate!=0)) {
1357 slot->
SetPar(
"GUI::Time", stime);
1358 slot->
SetPar(
"GUI::Date", sdate);
1363 const char* datetime = t.AsSQLString();
1364 char* time = (
char*) strchr(datetime,
' ');
1366 slot->
SetPar(
"GUI::Time",datetime);
1367 slot->
SetPar(
"GUI::Date",datetime);
1369 slot->
SetPar(
"GUI::Time", time+1);
1371 slot->
SetPar(
"GUI::Date", datetime);
1377 return slot==0 ? 0 : slot->
GetPar(
"GUI::Time");
1382 return slot==0 ? 0 : slot->
GetPar(
"GUI::Date");
1388 slot->
SetPar(
"::LinkedItem", itemname);
1393 return (slot==0) ? 0 : slot->
GetPar(
"::LinkedItem");
1411 if (slot==0)
return;
1412 if (kind>=0) slot->
SetIntPar(
"GUI::Kind", kind);
1414 slot->
SetPar(
"GUI::Class", classname);
1415 slot->
SetPar(
"GUI::Info", info);
1416 slot->
SetIntPar(
"GUI::SizeInfo", sizeinfo);
1421 return slot==0 ? 0 : slot->
GetPar(
"GUI::Info");
1426 if (slot==0)
return -1;
1428 if (!slot->
GetIntPar(
"GUI::SizeInfo", sizeinfo))
return -1;
1440 if (slot==0)
return 0;
1442 if (!slot->
GetIntPar(
"GUI::CalcSize", size))
return 0;
1458 return slot==0 ? 0 : slot->
GetPar(
"GUI::Class");
1473 if (slot==0)
return 0;
1476 if (!slot->
GetIntPar(
"GUI::CanDo", cando))
return 0;
1482 if (slot!=0) slot->
SetIntPar(
"GUI::CanDo", cando);
1487 return slot==0 ? kTRUE : slot->
GetPar(
"GUI::NotMonitored")==0;
1492 if (slot==0)
return;
1496 while (iter.
next()) {
1506 slot->
SetPar(
"GUI::NotMonitored",
"1");
1513 return (cando % 1000000000) / 100000000 > 0;
1518 return (cando % 100000000) / 10000000 > 0;
1523 return (cando % 10000000) / 1000000 > 0;
1528 return (cando % 1000000) / 100000 > 0;
1534 return (cando % 100000) / 10000 > 0;
1539 return (cando % 10000) / 1000 > 0;
1544 return (cando % 1000) / 100 > 0;
1549 return (cando % 100) / 10 > 0;
1554 return (cando % 10 > 0);
1559 if ((foldername!=0) && (*foldername!=0))
1562 TString fullpathname;
1572 if ((itemslot==0) || (newfoldername==0) || (strlen(newfoldername)==0))
return;
1575 if (!itemslot->
IsParent(memslot) && (memslot!=itemslot))
return;
1578 if (slot==0)
return;
1589 if ((itemslot==0) || (newname==0) || (strlen(newname)==0))
return;
1591 if ((strchr(newname,
'/')!=0) || (strchr(newname,
'\\')!=0))
return;
1594 if (!itemslot->
IsParent(memslot))
return;
1597 if (slot==0)
return;
1602 slot->SetName(newname);
1604 if (n!=0) n->SetName(newname);
1614 if (itemslot==0)
return;
1617 if (!itemslot->
IsParent(memslot))
return;
1620 if (slot==0)
return;
1625 if(ob->InheritsFrom(TH1::Class())) {
1626 TH1* his =
dynamic_cast<TH1*
>(ob);
1627 if (his) his->Reset();
1629 if(ob->InheritsFrom(TGo4DynamicEntry::Class())) {
1631 if (entry) entry->
Reset();
1633 if(ob->InheritsFrom(TGo4Picture::Class())) {
1635 if (pic) pic->
Reset();
1637 if(ob->InheritsFrom(TGraph::Class())) {
1638 TGraph* gr=
dynamic_cast<TGraph*
>(ob);
1640 Int_t pn = gr->GetN();
1645 if(ob->InheritsFrom(TMultiGraph::Class())) {
1646 TMultiGraph* mg =
dynamic_cast<TMultiGraph*
>(ob);
1648 TIter liter(mg->GetListOfGraphs());
1650 while(( gr = (TGraph*) liter())!=0) {
1651 Int_t pn = gr->GetN();
1667 if (obj==0)
return TString(
"");
1670 if ((pathname!=0) && (*pathname!=0)) {
1677 TString itemname = path;
1679 itemname+=obj->GetName();
1687 TString fullpathname;
1690 TGo4Slot* slot =
fxOM->
Add(fullpathname.Data(), obj, ownership, kTRUE);
1697 if (slot==0)
return;
1707 TString picitemname;
1717 for(Int_t posy=0; posy<pic->
GetDivY(); posy++)
1718 for(Int_t posx=0; posx<pic->
GetDivX(); posx++)
1732 TIter iter(gROOT->GetList());
1734 while ((obj=iter())!=0) {
1738 gROOT->GetList()->Clear();
1744 if(on) slot->
SetPar(
"GUI::CanDelete",
"1");
1751 return slot==0 ? kFALSE : slot->
GetPar(
"GUI::CanDelete")!=0;
1776 if (viewslot==0)
return 0;
1780 TObjArray UniqueItems;
1784 while (iter.
next()) {
1790 if ((srcslot!=0) && srcslot->
IsParent(brslot) &&
1791 (UniqueItems.FindObject(srcslot)==0))
1792 UniqueItems.Add(srcslot);
1796 Int_t nrequests = 0;
1797 for (
int n=0;n<=UniqueItems.GetLast();n++) {
1809 Int_t nrequests = 0;
1813 while (iter.
next()) {
1837 Bool_t anready = kTRUE;
1865 if (slot==0)
return;
1867 slot->
SetIntPar(
"GUI::DeleteProtect", delprot);
1871 slot->
SetIntPar(
"GUI::ResetProtect", clearprot);
1878 delprot = -1; clearprot = -1;
1879 if (slot==0)
return;
1880 if (!slot->
GetIntPar(
"GUI::DeleteProtect", delprot)) delprot = -1;
1881 if (!slot->
GetIntPar(
"GUI::ResetProtect", clearprot)) clearprot = -1;
1891 if (source==0)
return;
1894 if (curfold==0)
return;
1900 const char* EventsFolder =
"EventObjects/Events/";
1902 while (curfold!=0) {
1905 Bool_t res = iter.
next();
1911 while (levelchange++<0) {
1912 while (curslot!=0) {
1920 if (curfold==0)
break;
1928 while ((find!=0) && (strcmp(iter.
getname(), find->GetName())!=0))
1934 if (find!=curslot) {
1942 const char* ppp = strstr(fullname, EventsFolder);
1944 ppp += strlen(EventsFolder);
1945 if ((strlen(ppp)!=0) && (strchr(ppp,
'/')==0)) {
1958 TObject* assobj = 0;
1982 if ((curslot!=0) && curslot->
IsParent(targetslot))
1983 while (curslot!=0) {
2001 if (topslot==0)
return 0;
2007 for (Int_t n=0;n<topslot->
NumChilds();n++)
2032 if (cl->InheritsFrom(TProfile::Class())) { cando = 1110; pixmap =
"profile_t.png"; }
else
2033 if (cl->InheritsFrom(TGo4Picture::Class())) { cando = 110; pixmap =
"picture.png"; }
else
2034 if (cl->InheritsFrom(TGo4Parameter::Class())) { cando = 1011; pixmap =
"parameter.png"; }
else
2035 if (cl->InheritsFrom(TMultiGraph::Class())) { cando = 1110; pixmap =
"superimpose.png"; }
else
2036 if (cl->InheritsFrom(THStack::Class())) { cando = 1110; pixmap =
"superimpose.png"; }
else
2037 if (cl->InheritsFrom(TGraph::Class())) { cando = 1001110; pixmap =
"tgraph.png"; }
else
2038 if (cl->InheritsFrom(TGo4Fitter::Class())) { cando = 11; pixmap =
"fitter.png"; }
else
2039 if (cl->InheritsFrom(TCanvas::Class())) { cando = 110; pixmap =
"canvas.png"; }
else
2040 if (cl->InheritsFrom(TFile::Class())) { pixmap =
"rootdb_t.png"; }
else
2041 if (cl->InheritsFrom(TTree::Class())) { pixmap =
"tree_t.png"; }
else
2042 if (cl->InheritsFrom(TFolder::Class())) { pixmap =
"folder_t.png"; }
else
2043 if (cl->InheritsFrom(TDirectory::Class())) { pixmap =
"folder_t.png"; }
else
2044 if (cl->InheritsFrom(TH3::Class())) { cando = 1101110; pixmap =
"h3_t.png"; }
else
2045 if (cl->InheritsFrom(TH2::Class())) { cando = 1101110; pixmap =
"h2_t.png"; }
else
2046 if (cl->InheritsFrom(TH1::Class())) { cando = 1101110; pixmap =
"h1_t.png"; }
else
2047 if (cl->InheritsFrom(TGo4WinCond::Class())) { cando = 101011; pixmap =
"windcond.png"; }
else
2048 if (cl->InheritsFrom(TGo4PolyCond::Class())) { cando = 101011; pixmap =
"polycond.png"; }
else
2049 if (cl->InheritsFrom(TGo4ShapedCond::Class())) { cando = 101011; pixmap =
"polycond.png"; }
else
2050 if (cl->InheritsFrom(TGo4CondArray::Class())) { cando = 101011; pixmap =
"windcondarray.png"; }
else
2051 if (cl->InheritsFrom(TGo4TreeHistogramEntry::Class())) { cando = 1011; pixmap =
"dynentryx.png"; }
else
2052 if (cl->InheritsFrom(TGo4HistogramEntry::Class())) { cando = 1011; pixmap =
"dynentryx.png"; }
else
2053 if (cl->InheritsFrom(TLatex::Class())) { cando = 110; pixmap =
"canvas.png"; }
else
2054 if (cl->InheritsFrom(TF1::Class())) { cando = 110; pixmap =
"draw1dline.png"; }
else
2055 if (cl->InheritsFrom(TLeaf::Class())) { cando = 11; pixmap =
"leaf_t.png"; }
else
2056 if (cl->InheritsFrom(TGo4AnalysisStatus::Class())) { cando = 1; pixmap =
"control.png"; }
2060 pixmap =
"folder_t.png";
2061 if ((cl!=0) && cl->InheritsFrom(TTree::Class())) { cando = 10; pixmap =
"tree_t.png"; }
else
2062 if ((cl!=0) && cl->InheritsFrom(TCanvas::Class())) { cando = 110; pixmap =
"canvas.png"; }
else
2063 if ((cl!=0) && cl->InheritsFrom(THStack::Class())) { cando = 110; pixmap =
"superimpose.png"; }
else
2064 if ((cl!=0) && cl->InheritsFrom(TFile::Class())) { cando = 10000; pixmap =
"rootdb_t.png"; }
else
2065 if ((cl!=0) && cl->InheritsFrom(TGo4HServProxy::Class())) { cando = 10000; pixmap =
"histserv.png"; }
else
2066 if ((cl!=0) && cl->InheritsFrom(TGo4DabcProxy::Class())) { cando = 10000; pixmap =
"dabc.png"; }
else
2067 if ((cl!=0) && cl->InheritsFrom(TGo4AnalysisProxy::Class())) { pixmap =
"analysiswin.png"; }
else
2068 if ((cl!=0) && cl->InheritsFrom(TGo4ServerProxy::Class())) { cando = 10000; pixmap =
"http.png"; }
2072 pixmap =
"branch_t.png";
2075 cando = 11; pixmap =
"leaf_t.png";
2078 cando = 1011; pixmap =
"parameter.png";
2081 cando = 10; pixmap =
"eventitem.png";
2084 cando = 100010; pixmap =
"eventobj.png";
2087 cando = 100000000; pixmap =
"eventobj.png";
2095 if (v1==v2)
return kTRUE;
2097 return (fabs(v1-v2) <= scale);
2107 if ((ax1==0) || (ax2==0))
return 0;
2109 Int_t num1 = ax1->GetNbins();
2110 Int_t num2 = ax2->GetNbins();
2112 Double_t scale = fabs(ax1->GetXmax() - ax1->GetXmin()) / (num1+1.) * 1e-3;
2116 if ((num1>num2/2) || (num1<2))
return 0;
2118 Int_t rebin = num2/num1;
2119 if (rebin==0)
return 0;
2122 if ((ax1->GetXbins()->GetSize()!=0) || (ax1->GetXbins()->GetSize()!=0))
return 0;
2129 if (num1*rebin!=num2) xmax = ax2->GetBinUpEdge(num1*rebin);
2130 else xmax = ax2->GetXmax();
2138 if ((ax1->GetXbins()->GetSize()==0) && (ax1->GetXbins()->GetSize()==0)) {
2142 for (Int_t n=1;n<=num1;n++)
2144 ax2->GetBinCenter(n), scale))
return 0;
2152 Bool_t tdisp(kFALSE);
2155 if (obj->InheritsFrom(TH1::Class())) {
2156 TH1* histo =
dynamic_cast<TH1*
> (obj);
2157 TH1* histo2 =
dynamic_cast<TH1*
> (newobj);
2158 if ((histo==0) || (histo2==0))
return kFALSE;
2160 if (dynamic_cast<TProfile*>(obj)!=0)
return kFALSE;
2162 if (histo->GetDimension()!=histo2->GetDimension())
return kFALSE;
2164 histo->SetTitle(histo2->GetTitle());
2166 Int_t rebinx = 1, rebiny = 1;
2168 rebinx =
CompareAxis(histo->GetXaxis(), histo2->GetXaxis());
2169 if (histo->GetDimension()>1)
2170 rebiny =
CompareAxis(histo->GetYaxis(), histo2->GetYaxis());
2171 if (histo->GetDimension()>2)
2172 if (
CompareAxis(histo->GetZaxis(), histo2->GetZaxis())!=1)
return kFALSE;
2174 if ((rebinx==0) || (rebiny==0))
return kFALSE;
2178 if ((rebinx>1) || (rebiny>1)) {
2179 if ((hasrebinx==0) || (hasrebiny==0))
return kFALSE;
2181 TH1* clon = (TH1*) histo2->Clone(
"____dummyhisto____");
2182 if (clon==0)
return kFALSE;
2183 clon->SetDirectory(0);
2184 Bool_t rebinres = kFALSE;
2186 if (histo->GetDimension()==1) {
2187 clon->Rebin(rebinx);
2190 #if ROOT_VERSION_CODE > ROOT_VERSION(4,3,2)
2192 if (histo->GetDimension()==2) {
2193 TH2* h2 =
dynamic_cast<TH2*
>(clon);
2194 if (h2!=0) h2->Rebin2D(rebinx, rebiny);
2201 *hasrebinx = rebinx;
2202 *hasrebiny = rebiny;
2208 Int_t sz = histo->GetNbinsX()+2;
2209 if (histo->GetDimension()>1)
2210 sz = sz*(histo->GetNbinsY()+2);
2211 if (histo->GetDimension()>2)
2212 sz = sz*(histo->GetNbinsZ()+2);
2213 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
2214 Bool_t canrebin = histo->TestBit(TH1::kCanRebin);
2215 histo->SetBit(TH1::kCanRebin, kFALSE);
2217 Bool_t canrebin = histo->CanExtendAllAxes();
2218 histo->SetCanExtend(TH1::kNoAxis);
2221 for (
int n=0;n<sz;n++) {
2222 Stat_t value = histo2->GetBinContent(n);
2224 histo->SetBinContent(n, value);
2227 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
2228 if (canrebin) histo->SetBit(TH1::kCanRebin, kTRUE);
2230 if (canrebin) histo->SetCanExtend(TH1::kAllAxes);
2233 histo->SetEntries(sum);
2235 #if ROOT_VERSION_CODE > ROOT_VERSION(4,3,2)
2236 TArrayD *sumw_tgt = 0, *sumw_src = 0;
2238 if (histo2->GetSumw2N()>0)
2239 sumw_src = histo2->GetSumw2();
2245 histo->GetSumw2()->Set(0);
2250 if(histo->GetSumw2N()==0)
2252 sumw_tgt = histo->GetSumw2();
2255 if (sumw_src && sumw_tgt)
2256 sumw_tgt->Set(sz, sumw_src->GetArray());
2261 if (obj->InheritsFrom(TGo4Condition::Class())) {
2264 if ((cond==0) || (newcond==0))
return kFALSE;
2271 if (obj->InheritsFrom(TGraphAsymmErrors::Class())) {
2272 TGraphAsymmErrors* gr =
dynamic_cast<TGraphAsymmErrors*
> (obj);
2273 TGraph* newgr =
dynamic_cast<TGraph*
> (newobj);
2274 if ((gr==0) || (newgr==0))
return kFALSE;
2276 gr->SetTitle(newgr->GetTitle());
2278 Int_t npoints = newgr->GetN();
2280 Double_t xp, yp, exh, exl, eyh, eyl;
2281 for (Int_t n=0;n<npoints;n++) {
2282 newgr->GetPoint(n,xp,yp);
2283 gr->SetPoint(n,xp,yp);
2284 #if ROOT_VERSION_CODE > ROOT_VERSION(4,3,2)
2285 exh = newgr->GetErrorXhigh(n);
2286 exl = newgr->GetErrorXlow(n);
2287 eyh = newgr->GetErrorYhigh(n);
2288 eyl = newgr->GetErrorYlow(n);
2289 gr->SetPointError(n, exl, exh, eyl, eyh);
2297 if (obj->InheritsFrom(TGraphErrors::Class())) {
2298 TGraphErrors* gr =
dynamic_cast<TGraphErrors*
> (obj);
2299 TGraph* newgr =
dynamic_cast<TGraph*
> (newobj);
2300 if ((gr==0) || (newgr==0))
return kFALSE;
2302 gr->SetTitle(newgr->GetTitle());
2304 Int_t npoints = newgr->GetN();
2306 Double_t xp, yp, ex, ey;
2307 for (Int_t n=0;n<npoints;n++) {
2308 newgr->GetPoint(n,xp,yp);
2309 gr->SetPoint(n,xp,yp);
2310 ex = newgr->GetErrorX(n);
2311 ey = newgr->GetErrorY(n);
2312 gr->SetPointError(n, ex, ey);
2320 if (obj->InheritsFrom(TGraph::Class())) {
2321 TGraph* gr =
dynamic_cast<TGraph*
> (obj);
2322 TGraph* newgr =
dynamic_cast<TGraph*
> (newobj);
2323 if ((gr==0) || (newgr==0))
return kFALSE;
2328 gr->SetTitle(newgr->GetTitle());
2330 Int_t npoints = newgr->GetN();
2333 for (Int_t n=0;n<npoints;n++) {
2334 newgr->GetPoint(n,xp,yp);
2335 gr->SetPoint(n,xp,yp);
2342 if (obj->InheritsFrom(TLatex::Class())) {
2343 TLatex* l0 =
dynamic_cast<TLatex*
> (obj);
2344 TLatex* l1 =
dynamic_cast<TLatex*
> (newobj);
2345 if ((l1==0) || (l0==0))
return kFALSE;
2347 l0->SetTitle(l1->GetTitle());
2352 if (obj->InheritsFrom(TF1::Class())) {
2354 TF1* f0 =
dynamic_cast<TF1*
> (obj);
2355 TF1* f1 =
dynamic_cast<TF1*
> (newobj);
2356 if ((f1==0) || (f0==0))
return kFALSE;
2369 TH1* h1=gr->GetHistogram();
2370 TAxis* xax=h1->GetXaxis();
2371 timedisplay=xax->GetTimeDisplay();
2372 format=xax->GetTimeFormat();
2378 TH1*h1=gr->GetHistogram();
2379 TAxis* xax=h1->GetXaxis();
2380 xax->SetTimeDisplay(timedisplay);
2381 xax->SetTimeFormat(format.Data());
2387 if(oldgr==0 || newgr==0)
return;
2388 TList* theFunctions=oldgr->GetListOfFunctions();
2390 while ((obj = theFunctions->First())) {
2391 while (theFunctions->Remove(obj)) { }
2396 TList* newFunctions=newgr->GetListOfFunctions();
2397 TListIter fiter(newFunctions);
2399 while((fun=dynamic_cast<TF1*>(fiter.Next())) !=0)
2401 TF1* fclon=
dynamic_cast<TF1*
>(fun->Clone());
2402 theFunctions->Add(fclon);
2403 fclon->SetParent(oldgr);
2409 TH1* oldhis=oldgr->GetHistogram();
2410 TH1* newhis=newgr->GetHistogram();
2411 if(oldhis && newhis)
2413 oldhis->GetXaxis()->SetTitle(newhis->GetXaxis()->GetTitle());
2414 oldhis->GetYaxis()->SetTitle(newhis->GetYaxis()->GetTitle());
2423 if (itemslot==0)
return;
2429 TNamed* n = (TNamed*)
fxWaitingList->FindObject(itemname.Data());
2431 n->SetTitle(destination);
2433 fxWaitingList->Add(
new TNamed(itemname.Data(), destination));
2443 TNamed* n = (TNamed*)
fxWaitingList->FindObject(itemname.Data());
2445 const char* dest = n->GetTitle();
2446 if ((dest!=0) && (strlen(dest)==0)) dest = 0;
2457 TIter next(gROOT->GetListOfCanvases());
2459 while ((pad = (TPad*) next()) != 0) {
2462 TVirtualPad* subpad = 0;
2464 while ((subpad = pad->GetPad(number++))!=0)
static bool CanClearItem(int cando)
Bool_t Connect(const char *nodename)
void SetCanDelete(TGo4Slot *slot, Bool_t on=kTRUE)
virtual void SetChanged(Bool_t on)
static void RestoreAxisTimeProperties(TGraph *gr, Bool_t &timedisplay, TString &format)
void OpenFile(const char *fname)
Bool_t GetIntPar(const char *name, Int_t &value)
static void SaveAxisTimeProperties(TGraph *gr, Bool_t &timedisplay, TString &format)
void SetStartDir(const char *dir=0)
static TClass * GetClass(const char *classname, Bool_t load=kFALSE)
virtual Bool_t IsConnected()
Bool_t IsItemMonitored(TGo4Slot *slot)
void MakeHttpList(TObjArray *arr)
TString FindItem(const char *objname)
void SetIntPar(const char *name, Int_t value)
virtual void Update(TGo4Slot *slot, Bool_t strong)
void SetOutFileComment(const char *comment=0)
TString SaveToMemory(const char *pathname, TObject *obj, Bool_t ownership, Bool_t overwrite=kFALSE)
TObject * GetBrowserObject(const char *name, Int_t update=0)
void CheckPictureMonitor(TGo4Slot *slot)
void DataSlotName(const char *item, TString &res)
void SetProxy(TGo4Proxy *cont)
virtual Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
void ExportItemsTo(TObjArray *items, Bool_t fetchitems, const char *filename, const char *filedir, const char *format, const char *description)
TGo4Slot * FindSlot(const char *fullpath, const char **subname=0)
Int_t RequestObject(const char *source, const char *targetslot, Int_t waittime_millisec=0)
Int_t ItemKind(const char *name)
static Bool_t UpdateObjectContent(TObject *obj, TObject *newobj, Int_t *hasrebinx=0, Int_t *hasrebiny=0)
virtual const char * GetContainedClassName()
void UpdateBrowserContent()
virtual void Initialize(TGo4Slot *slot)
Bool_t DefineLeafName(const char *itemname, const char *treename, TString &leafname)
void AddFile(const char *pathname, const char *filename)
void UnregisterLink(TGo4Slot *target)
Bool_t IsItemRemote(const char *name)
void SetCurrentDir(const char *dir=0)
static bool CanDrawItem(int cando)
TGo4Proxy * GetProxy() const
const char * GetObjName(Int_t n)
Int_t UpdateVisibleAnalysisObjects(bool checkmonitor)
void RenameMemoryItem(const char *itemname, const char *newname)
virtual void ProduceFullName(TString &name, TGo4Slot *toparent=0)
void MakeFolder(const char *pathname)
Int_t UpdateAllMonitoredObjects()
void SetProtectionBits(TGo4Slot *slot, Int_t delprot, Int_t clearprot)
Int_t ItemCanDo(const char *name)
virtual Bool_t IsGo4Analysis() const
TGo4Slot * getslot() const
Bool_t DeleteDataSource(TGo4Slot *itemslot)
void MakeHServerList(TObjArray *arr)
TGo4ServerProxy * DefineServerObject(const char *itemname, TString *objname=0, Bool_t onlyanalysis=kTRUE)
Bool_t IsAnalysisItem(const char *name)
void RegisterLink(TGo4Slot *source, TGo4Slot *target, Bool_t exapndchilds=kFALSE)
const char * GetPar(const char *name) const
void PerformTreeDraw(const char *treename, const char *Xexp, const char *Yexp, const char *Zexp, const char *cutcond, const char *hname, TString &createdhistoname)
static Bool_t CompareAxisValues(Double_t v1, Double_t v2, Double_t scale)
static bool CanExecuteItem(int cando)
void DoItemMonitor(TGo4Slot *slot)
TClass * ItemClass(const char *name)
void DeleteChilds(const char *startedwith=0)
static bool CanExpandItem(int cando)
Int_t RequestBrowserObject(const char *name, Int_t wait_time=0)
virtual Bool_t AssignObject(TGo4Slot *slot, TObject *obj, Bool_t owner)
static Int_t CompareAxis(TAxis *ax1, TAxis *ax2)
virtual Bool_t AssignObject(TGo4Slot *slot, TObject *obj, Bool_t owner)
virtual Bool_t RequestObjectStatus(const char *objectname, TGo4Slot *tgtslot)
void CheckWaitingList(TGo4Slot *source)
void AddWaitingList(TGo4Slot *itemslot, const char *destination=0)
TGo4Slot * FindServerSlot(Bool_t databranch, Int_t kind=0)
TGo4ServerProxy * FindServer(const char *itemname=0, Bool_t asanalysis=kTRUE)
const char * getclassname()
Bool_t ConnectHServer(const char *servername, Int_t portnumber, const char *basename, const char *userpass, const char *filter)
void CreateMemorySubfolder(const char *itemname, const char *newfoldername)
Int_t getflag(const char *flagname)
virtual Bool_t HandleTimer(TTimer *timer)
Bool_t SaveBrowserToFile(const char *filename, Bool_t prefetch=kFALSE, const char *selectedpath=0, const char *description=0)
virtual void Finalize(TGo4Slot *slot)
void DeleteSlot(const char *pathname)
TGo4Slot * DataSlot(const char *item)
Bool_t ShiftSlotBefore(TGo4Slot *slot, TGo4Slot *before)
static const char * ItemInfo(TGo4Slot *slot)
static bool CanDragItem(int cando)
TObject * GetAssignedObject()
Bool_t IsCanDelete(TGo4Slot *slot)
Int_t CalculateFolderSizes(TGo4Slot *topslot)
void CopyClipboard(const char *tgtpath, Bool_t forcerequest=kFALSE)
const char * getfullname()
static bool CanExportItem(int cando)
Bool_t IsParent(const TGo4Slot *slot) const
virtual Bool_t RefreshNamesList()
TObject * GetObject(const char *name=0)
TGo4Slot * FindChild(const char *name)
Bool_t DefineFileObject(const char *itemname, TString &filedataslot, const char **filepath)
void CreateMemoryFolder(const char *foldername=0)
void ClearMemoryItem(const char *itemname)
virtual void RemoteTreeDraw(const char *treename, const char *varexp, const char *cutcond, const char *hname)
TGo4Slot * GetParent() const
Int_t ItemSizeInfo(TGo4Slot *slot)
void MakeFilesList(TObjArray *arr)
virtual void Update(Bool_t strong=kFALSE)
void MakeDabcList(TObjArray *arr)
static const char * ItemDate(TGo4Slot *slot)
virtual Bool_t UpdateAnalysisObject(const char *objectname, TObject *obj)
TGo4Slot * GetSlot(const char *name, Bool_t force=kFALSE)
void SaveDataToFile(TFile *f, Bool_t onlyobjs=kFALSE, TGo4Slot *startslot=0)
virtual ~TGo4BrowserObjProxy()
Bool_t UpdateObjectInFile(const char *filepath, TObject *obj)
void RequestObjectStatus(const char *name, TGo4Slot *tgtslot)
void RemovePar(const char *name)
TString FindItemInAnalysis(const char *objname)
const char * ItemClassName(const char *name)
TVirtualTreePlayer * fDummyTreePlayer
static const char * Message(Int_t prio, const char *text,...)
void AddToClipboard(const char *itemname)
void FetchItem(const char *itemname, Int_t wait_time=0)
Bool_t DefineRelatedObject(const char *itemname, const char *objectname, TString &objectitem, Int_t mask=3)
Int_t GetCalcSize(TGo4Slot *slot)
TGo4Slot * BrowserSlot(const char *item)
void SetItemMonitored(TGo4Slot *slot, Bool_t on=kTRUE)
virtual ~TGo4BrowserProxy()
TGo4Slot * BrowserMemorySlot()
TGo4Picture * FindPic(Int_t posy, Int_t posx)
Bool_t ProduceExplicitCopy(const char *itemname, const char *tgtpath=0, Bool_t forcerequest=kFALSE)
void AddProxy(const char *pathname, TGo4Proxy *cont, const char *name, const char *title="title")
Bool_t ConnectDabc(const char *nodename)
void RedrawItem(const char *itemname)
static bool CanCloseItem(int cando)
void SetHServConfig(const char *servername, Int_t portnumber, const char *basename, const char *userpass, const char *filter)
TGo4AnalysisProxy * FindAnalysis(const char *itemname=0)
void InformBrowserUpdate()
static const char * GetLinkedName(TGo4Slot *slot)
Bool_t DefineTreeName(const char *itemname, TString &treename)
void GetProtectionBits(TGo4Slot *slot, Int_t &delprot, Int_t &clearprot)
TGo4ServerProxy * DefineServerProxy(const char *itemname)
static void SetItemCanDo(TGo4Slot *slot, Int_t cando)
static void ProduceFolderAndName(const char *fullname, TString &foldername, TString &objectname)
TGo4Slot * GetLink() const
void ForwardEvent(TGo4Slot *source, Int_t id, void *param=0)
Int_t levelchange() const
void Export(TObject *ob, Go4Export_t format)
TGo4Slot * BrowserTopSlot()
void SetOutFile(const char *filename=0)
void AddServerProxy(TGo4ServerProxy *serv, const char *slotname, const char *info)
void SetCalcSize(TGo4Slot *slot, Int_t size)
virtual Bool_t ProcessEvent(TGo4Slot *slot, TGo4Slot *source, Int_t id, void *param)
void SetItemKind(TGo4Slot *slot, Int_t kind, const char *classname, const char *info, Int_t sizeinfo)
Bool_t AssignObject(TObject *obj, Bool_t owner)
static bool CanInfoItem(int cando)
TGo4BrowserObjProxy(TGo4Slot *slot, TObject *obj, Bool_t owner)
TString GetFullName(TGo4Slot *toparent=0)
virtual Bool_t DelayedRefreshNamesList(Int_t delay_sec)
static void SetLinkedName(TGo4Slot *slot, const char *itemname)
TGo4ServerProxy * DefineAnalysisObject(const char *itemname, TString &analysisname)
virtual const char * GetServerName() const
virtual Int_t NumberOfWaitingProxyes()
virtual TGo4ObjectManager * GetOM() const
Bool_t UpdateObjectInFile(const char *itemname, const char *fileslotname, const char *filepath)
void SetItemsFilter(Int_t filter)
void SetPar(const char *name, const char *value)
TGo4Slot * GetChild(Int_t n) const
static const char * ItemTime(TGo4Slot *slot)
static void UpdateListOfFunctions(TGraph *oldgr, TGraph *newgr)
Bool_t UpdateAnalysisItem(const char *itemname, TObject *obj=0)
static bool CanEditItem(int cando)
Bool_t BrowserItemName(TGo4Slot *itemslot, TString &res)
TGo4Slot * ItemSlot(const char *itemname)
static void SetItemTimeDate(TGo4Slot *slot, const char *stime=0, const char *sdate=0)
TGo4Slot * Add(const char *pathname, TObject *obj, Bool_t owner=kFALSE, Bool_t canrename=kFALSE)
static Int_t DefineItemProperties(Int_t kind, TClass *cl, TString &pixmap)
void ToggleMonitoring(Int_t period)
Bool_t SaveItemToFile(const char *itemname, const char *filename, const char *subfolder=0)
Bool_t next(Bool_t goesinto=kTRUE)
virtual Bool_t Use() const
void BrowserSlotName(const char *item, TString &res)