GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4BrowserProxy.cxx
Go to the documentation of this file.
1 // $Id: TGo4BrowserProxy.cxx 2172 2018-10-25 11:22:19Z adamczew $
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 für 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 "TGo4BrowserProxy.h"
15 
16 #include <math.h>
17 #include <string.h>
18 
19 #include "RVersion.h"
20 
21 #include "TH1.h"
22 #include "TH2.h"
23 #include "TH3.h"
24 #include "THStack.h"
25 #include "TProfile.h"
26 #include "TGraph.h"
27 #include "TGraphErrors.h"
28 #include "TGraphAsymmErrors.h"
29 #include "TMultiGraph.h"
30 #include "TList.h"
31 #include "TFolder.h"
32 #include "TDirectory.h"
33 #include "TFile.h"
34 #include "TTree.h"
35 #include "TLeaf.h"
36 // #include "TPad.h"
37 #include "TCanvas.h"
38 #include "TTimer.h"
39 #include "TROOT.h"
40 #include "TObjString.h"
41 #include "TDatime.h"
42 #include "TObjectTable.h"
43 #include "TLatex.h"
44 
45 #include "TGo4Log.h"
46 #include "TGo4LockGuard.h"
47 #include "TGo4Slot.h"
48 #include "TGo4ObjectProxy.h"
49 #include "TGo4DirProxy.h"
50 #include "TGo4LinkProxy.h"
51 #include "TGo4Iter.h"
52 #include "TGo4ObjectManager.h"
53 
54 #include "TGo4Condition.h"
55 #include "TGo4Fitter.h"
56 #include "TGo4Parameter.h"
57 #include "TGo4Picture.h"
58 #include "TGo4Condition.h"
59 #include "TGo4PolyCond.h"
60 #include "TGo4WinCond.h"
61 #include "TGo4ShapedCond.h"
62 #include "TGo4CondArray.h"
63 #include "TGo4HistogramEntry.h"
64 #include "TGo4TreeHistogramEntry.h"
65 #include "TGo4ExportManager.h"
66 
67 #include "TGo4ServerProxy.h"
68 #include "TGo4AnalysisProxy.h"
69 #include "TGo4AnalysisStatus.h"
70 #include "TGo4HServProxy.h"
71 #include "TGo4DabcProxy.h"
72 #include "TVirtualTreePlayer.h"
73 
74 // required for ROOT browser
75 // #include "TGo4BrowserItem.h"
76 // #include "TGClient.h"
77 // #include "TGMimeTypes.h"
78 
79 
81  public:
83  TGo4BrowserObjProxy(TGo4Slot* slot, TObject* obj, Bool_t owner) : TGo4ObjectProxy(obj, owner)
84  {
85  if ((slot!=0) && (obj!=0))
87  }
88 
89  virtual ~TGo4BrowserObjProxy() {}
90 
91  virtual Bool_t Use() const { return kFALSE; }
92 
93  virtual Bool_t AssignObject(TGo4Slot* slot, TObject* obj, Bool_t owner)
94  {
95  if (fObject==obj) return kTRUE;
96 
97  Bool_t updatedone = false;
98 
99  if ((fObject!=0) && (obj!=0))
100  if ((fObject->IsA()==obj->IsA()) &&
101  (strcmp(fObject->GetName(), obj->GetName())==0))
103 
104  if (obj!=0)
106 
107  if (updatedone) {
109  if (owner) delete obj;
110  return kTRUE;
111  }
112 
113  return TGo4ObjectProxy::AssignObject(slot, obj, owner);
114  }
115 
116  virtual void Update(TGo4Slot* slot, Bool_t strong)
117  {
118  // can not update object which is not there
119  if ((fObject==0) && !strong) return;
120 
121  TGo4Slot* parent = slot->GetParent();
122  TGo4BrowserProxy* browser = 0;
123 
124  while(parent!=0) {
125  browser = dynamic_cast<TGo4BrowserProxy*> (parent->GetProxy());
126  if (browser!=0) break;
127  parent = parent->GetParent();
128  }
129  if (browser!=0)
130  browser->RequestBrowserObject(slot);
131  }
132 };
133 
134 // ******************************************************************
135 
137  TGo4Proxy(),
138  fxDataPath(),
139  fxBrowserPath(),
140  fxViewPath(),
141  fbWithRootBrowser(kFALSE),
142  fxMemoryPath(),
143  fxOM(0),
144  fxBrowserSlot(0),
145  fiMonitoringPeriod(0),
146  fxMonitorTimer(0),
147  fbBlockMonitoring(kFALSE),
148  fiFilterIndex(0),
149  fxWaitingList(0),
150  fxClipboard(0),
151  fxSyncTimer(0),
152  fbBlockSync(kFALSE),
153  fDummyTreePlayer(0)
154 {
155 }
156 
158  const char* viewpath,
159  Bool_t withRootBrowser) :
160  TGo4Proxy(),
161  fxDataPath(datapath),
162  fxBrowserPath(),
163  fxViewPath(viewpath),
164  fbWithRootBrowser(withRootBrowser),
165  fxMemoryPath("Workspace"),
166  fxOM(0),
167  fxBrowserSlot(0),
168  fiMonitoringPeriod(0),
169  fxMonitorTimer(0),
170  fbBlockMonitoring(kFALSE),
171  fiFilterIndex(0),
172  fxWaitingList(0),
173  fxClipboard(0),
174  fxSyncTimer(0),
175  fbBlockSync(kFALSE),
176  fDummyTreePlayer(0)
177 {
178 }
179 
181 {
182  if (gDebug>1) Info("~TGo4BrowserProxy","Called");
183 
184  if (fDummyTreePlayer!=0) {
185  delete fDummyTreePlayer;
186  fDummyTreePlayer = 0;
187  }
188 
189  if (fxWaitingList!=0) {
190  fxWaitingList->Delete();
191  delete fxWaitingList;
192  fxWaitingList = 0;
193  }
194 
195  ClearClipboard();
196 
197  if (fxSyncTimer!=0) {
198  delete fxSyncTimer;
199  fxSyncTimer = 0;
200  }
201 
202  if (fxMonitorTimer!=0) {
203  delete fxMonitorTimer;
204  fxMonitorTimer = 0;
205  }
206 
207  if (gDebug>1) Info("~TGo4BrowserProxy","Finished");
208 }
209 
211 {
212  fxOM = slot->GetOM();
213  fxBrowserSlot = slot;
214  fxBrowserPath = "";
216 
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");
235 
236  gROOT->GetClass("TGo4WinCond");
237  gROOT->GetClass("TGo4PolyCond");
238  gROOT->GetClass("TGo4ShapedCond");
239  gROOT->GetClass("TGo4CondArray");
240 
241  gROOT->GetClass("TGo4Fitter");
242  gROOT->GetClass("TGo4Parameter");
243  gROOT->GetClass("TGo4Picture");
244 
245  gROOT->GetClass("TGo4DynamicEntry");
246  gROOT->GetClass("TGo4HistogramEntry");
247  gROOT->GetClass("TGo4TreeHistogramEntry");
248  gROOT->GetClass("TLatex");
249  gROOT->GetClass("TF1"); // JAM test
250  gROOT->GetClass("TGo4AnalysisStatus");
251 
252  if (fxOM!=0)
253  fxOM->RegisterLink(fxOM->GetSlot(fxDataPath.Data()), slot, kTRUE);
254 
255  fiMonitoringPeriod = 0;
256 }
257 
259 {
260  if (fxOM!=0) fxOM->UnregisterLink(slot);
261  fxOM = 0;
262  fxBrowserSlot = 0;
263  fxBrowserPath = "";
264 }
265 
266 Bool_t TGo4BrowserProxy::ProcessEvent(TGo4Slot* slot, TGo4Slot* source, Int_t id, void* param)
267 {
268  bool ischildevent = source->IsParent(slot);
269 
270 // Info("ProcessEvent","Source %x %s event %d", source, source->GetName(), id);
271 
272  if ((source!=slot) && !ischildevent) {
273  if (source->GetParent()!=0) {
274  TGo4ServerProxy* serv = dynamic_cast<TGo4ServerProxy*>(source->GetParent()->GetProxy());
275  if (serv && serv->IsGo4Analysis()) return kFALSE; // suppress message from analysis subitems
276  }
277 
278  if (!fbBlockSync) {
279  if (fxSyncTimer==0) fxSyncTimer = new TTimer(this, 10, kTRUE);
280  fbBlockSync = kTRUE;
281  fxSyncTimer->Start(10, kTRUE);
282  }
283 
284  return kFALSE; // do not process further
285  } else
286  if ((source!=slot) && ischildevent) {
287  if ((id==TGo4Slot::evObjUpdated) || (id==TGo4Slot::evObjAssigned)) {
288  CheckWaitingList(source);
289  slot->ForwardEvent(slot, TGo4Slot::evSubslotUpdated, (void*) source);
290  CheckPictureMonitor(source);
291  }
292  }
293 
294  return kTRUE;
295 }
296 
297 void TGo4BrowserProxy::DataSlotName(const char* item, TString& res)
298 {
299  res = fxDataPath;
300  res += "/";
301  res += item;
302 }
303 
304 void TGo4BrowserProxy::BrowserSlotName(const char* item, TString& res)
305 {
306  res = fxBrowserPath;
307  res += "/";
308  res += item;
309 }
310 
312 {
313  TString slotname;
314  BrowserSlotName(item, slotname);
315  return fxOM->GetSlot(slotname.Data());
316 }
317 
319 {
320  TString slotname;
321  DataSlotName(item, slotname);
322  return fxOM->GetSlot(slotname.Data());
323 }
324 
326 {
327  return BrowserSlot(fxMemoryPath.Data());
328 }
329 
330 Bool_t TGo4BrowserProxy::BrowserItemName(TGo4Slot* itemslot, TString& res)
331 {
332  if ((itemslot==0) || (fxBrowserSlot==0) || !itemslot->IsParent(fxBrowserSlot)) return kFALSE;
333  itemslot->ProduceFullName(res, fxBrowserSlot);
334  return kTRUE;
335 }
336 
338 {
339  fxBrowserSlot->Update(kFALSE);
340 
341  TGo4Iter iter(fxOM->GetSlot(fxDataPath), kTRUE);
342  while(iter.next()) {
343  TGo4Slot* subslot = iter.getslot();
344  TGo4ServerProxy* ancont = dynamic_cast<TGo4ServerProxy*>(subslot->GetProxy());
345  if (ancont && ancont->IsGo4Analysis()) subslot->Update(kTRUE);
346  }
347 }
348 
349 Int_t TGo4BrowserProxy::RequestBrowserObject(const char* name, Int_t wait_time)
350 {
351  if ((name==0) || (fxBrowserSlot==0) || (fxOM==0)) return 0;
352 
353  Int_t kind = ItemKind(name);
354  if (kind==TGo4Access::kndObject) {
355  TClass* cl = ItemClass(name);
356  if ((cl==0) || !cl->IsLoaded()) return 0;
357  }
358 
359  TString src, tgt;
360 
361  DataSlotName(name, src);
362  BrowserSlotName(name, tgt);
363 
364  return fxOM->RequestObject(src.Data(), tgt.Data(), wait_time);
365 }
366 
368 {
369  if ((slot==0) || !slot->IsParent(fxBrowserSlot)) return 0;
370  TString name;
371  slot->ProduceFullName(name, fxBrowserSlot);
372  return RequestBrowserObject(name.Data(), wait_time);
373 }
374 
375 Bool_t TGo4BrowserProxy::ProduceExplicitCopy(const char* itemname, const char* tgtpath, Bool_t forcerequest)
376 {
377  return ProduceExplicitCopy(BrowserSlot(itemname), tgtpath, forcerequest);
378 }
379 
380 Bool_t TGo4BrowserProxy::ProduceExplicitCopy(TGo4Slot* itemslot, const char* tgtpath, Bool_t forcerequest)
381 {
382  TGo4LockGuard lock;
383 
384  if (itemslot==0) return kFALSE;
385 
386  // std::cout << "ProduceExplicitCopy " << itemslot->GetFullName() << " " << (tgtpath ? tgtpath : "null") << std::endl;
387 
388  TGo4Slot* memslot = BrowserMemorySlot();
389  if (itemslot->IsParent(memslot) && (tgtpath==0)) return kFALSE;
390  if (tgtpath!=0) {
391  TGo4Slot* tgtslot = BrowserSlot(tgtpath);
392  if (tgtslot==0) return kFALSE;
393  if ((tgtslot==itemslot) || tgtslot->IsParent(itemslot)) return kFALSE;
394  }
395 
396  if (itemslot->NumChilds()>0) {
397  Bool_t res = kTRUE;
398  TObjArray childs;
399  for (Int_t n=0;n<itemslot->NumChilds();n++)
400  childs.Add(itemslot->GetChild(n));
401 
402  TString subpath;
403  // create subpath for paste from clipboard folder
404  if (tgtpath!=0) {
405  TGo4Slot* tgtslot = DataSlot(tgtpath);
406  if (tgtslot==0) return kFALSE;
407  if (tgtslot->GetSlot(itemslot->GetName(), kTRUE)==0) return kFALSE;
408 
409  // synchronize folder structures in browser branch
411 
412  subpath = tgtpath;
413  subpath += "/";
414  subpath += itemslot->GetName();
415 
416  tgtpath = subpath.Data();
417  }
418 
419  for (Int_t n=0;n<=childs.GetLast();n++) {
420  Bool_t res1 = ProduceExplicitCopy((TGo4Slot*)childs.At(n), tgtpath, forcerequest);
421  res = res || res1;
422  }
423 
424  return res;
425  }
426 
427  if (ItemKind(itemslot)!=TGo4Access::kndObject) return kFALSE;
428 
429  TString pathname;
430  if (tgtpath!=0) {
431  TGo4Slot* tgtslot = ItemSlot(tgtpath);
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)
436  tgtslot->ProduceFullName(pathname, memslot);
437  } else {
438  if (!BrowserItemName(itemslot->GetParent(), pathname)) return kFALSE;
439  }
440 
441  TObject* obj = itemslot->GetAssignedObject();
442 
443  if ((obj==0) || forcerequest) {
444  Int_t res = RequestBrowserObject(itemslot);
445  if (res==0) return kFALSE;
446  obj = 0;
447  if ((res==1) || !forcerequest)
448  obj = itemslot->GetAssignedObject();
449  }
450 
451  if (obj!=0) {
452  TString res = SaveToMemory(pathname, obj->Clone(), kTRUE);
453  return res.Length()>0;
454  }
455 
456  AddWaitingList(itemslot, tgtpath);
457 
458  return kTRUE;
459 }
460 
462 {
463  if (fxClipboard!=0) {
464  fxClipboard->Delete();
465  delete fxClipboard;
466  fxClipboard = 0;
467  }
468 }
469 
470 void TGo4BrowserProxy::AddToClipboard(const char* itemname)
471 {
472  if (fxClipboard==0) fxClipboard = new TObjArray;
473 
474  if (fxClipboard->FindObject(itemname)) return;
475 
476  TGo4Slot* itemslot = BrowserSlot(itemname);
477  if (itemslot==0) return;
478 
479  // check if parent of that item already in clipboard
480  for (Int_t n=0;n<=fxClipboard->GetLast();n++) {
481  TNamed* nm = (TNamed*) fxClipboard->At(n);
482  TGo4Slot* slot = ItemSlot(nm->GetName());
483  if (slot==0) continue;
484  if (itemslot->IsParent(slot)) return;
485  }
486 
487  fxClipboard->Add(new TNamed(itemname, "clipboard item"));
488 }
489 
491 {
492  return fxClipboard!=0;
493 }
494 
495 void TGo4BrowserProxy::CopyClipboard(const char* tgtpath, Bool_t forcerequest)
496 {
497  if (fxClipboard==0) return;
498 
499  for(Int_t n=0;n<=fxClipboard->GetLast();n++)
500  ProduceExplicitCopy(fxClipboard->At(n)->GetName(), tgtpath, forcerequest);
501 }
502 
503 void TGo4BrowserProxy::OpenFile(const char* fname)
504 {
505  if ((fname==0) || (*fname==0)) return;
506 
507  fxOM->AddFile(fxDataPath.Data(), fname);
508 
510 }
511 
512 void TGo4BrowserProxy::AddServerProxy(TGo4ServerProxy* serv, const char* slotname, const char* info)
513 {
514  fxOM->AddProxy(fxDataPath.Data(), serv, slotname, info);
515 
517 }
518 
519 Bool_t TGo4BrowserProxy::ConnectDabc(const char* nodename)
520 {
521  if ((nodename==0) || (*nodename==0)) return kFALSE;
522 
523  TGo4DabcProxy* proxy = new TGo4DabcProxy();
524  if (!proxy->Connect(nodename)) {
525  delete proxy;
526  return kFALSE;
527  }
528 
529  const char* slotname = nodename;
530  if (strncmp(slotname,"dabc://",7)==0) slotname+=7;
531 
532  AddServerProxy(proxy, slotname, "Connection to DABC server");
533 
534  return kTRUE;
535 }
536 
537 
538 Bool_t TGo4BrowserProxy::ConnectHServer(const char* servername,
539  Int_t portnumber,
540  const char* basename,
541  const char* userpass,
542  const char* filter)
543 {
544  Bool_t res = kFALSE;
545 
546  TGo4HServProxy* hserv = new TGo4HServProxy;
547 
548  hserv->SetHServConfig(servername,
549  portnumber,
550  basename,
551  userpass,
552  filter);
553 
554  if (hserv->RefreshNamesList()) {
555  TString capt = "HServ_";
556  capt += basename;
557 
558  AddServerProxy(hserv, capt.Data(), "Connection to histogram server");
559  res = kTRUE;
560  } else {
561  delete hserv;
562  }
563  return res;
564 }
565 
567 {
568  if (arr==0) return;
569  arr->Clear();
570  TGo4Slot* slot = fxOM->GetSlot(fxDataPath.Data());
571  if (slot==0) return;
572 
573  for(Int_t n=0;n<slot->NumChilds();n++) {
574  TGo4Slot* subslot = slot->GetChild(n);
575  TGo4DirProxy* pr = dynamic_cast<TGo4DirProxy*> (subslot->GetProxy());
576  if ((pr!=0) && pr->IsFile())
577  arr->Add(pr);
578  }
579 }
580 
582 {
583  if (arr==0) return;
584  arr->Clear();
585  TGo4Slot* slot = fxOM->GetSlot(fxDataPath.Data());
586  if (slot==0) return;
587 
588  for(Int_t n=0;n<slot->NumChilds();n++) {
589  TGo4Slot* subslot = slot->GetChild(n);
590  TGo4HServProxy* pr = dynamic_cast<TGo4HServProxy*> (subslot->GetProxy());
591  if (pr!=0) arr->Add(pr);
592  }
593 }
594 
595 void TGo4BrowserProxy::MakeDabcList(TObjArray* arr)
596 {
597  if (arr==0) return;
598  arr->Clear();
599  TGo4Slot* slot = fxOM->GetSlot(fxDataPath.Data());
600  if (slot==0) return;
601 
602  for(Int_t n=0;n<slot->NumChilds();n++) {
603  TGo4Slot* subslot = slot->GetChild(n);
604  TGo4DabcProxy* pr = dynamic_cast<TGo4DabcProxy*> (subslot->GetProxy());
605  if (pr!=0) arr->Add(pr);
606  }
607 }
608 
609 void TGo4BrowserProxy::MakeHttpList(TObjArray* arr)
610 {
611  if (arr==0) return;
612  arr->Clear();
613  TGo4Slot* slot = fxOM->GetSlot(fxDataPath.Data());
614  if (slot==0) return;
615 
616  for(Int_t n=0;n<slot->NumChilds();n++) {
617  TGo4Slot* subslot = slot->GetChild(n);
618  TGo4ServerProxy* pr = dynamic_cast<TGo4ServerProxy*> (subslot->GetProxy());
619  if ((pr==0) || strcmp(pr->GetContainedClassName(),"TGo4ServerProxy")) continue;
620 
621  if ((strncmp(pr->GetServerName(),"http://",7)==0) ||
622  (strncmp(pr->GetServerName(),"https://",8)==0)) arr->Add(pr);
623  }
624 }
625 
626 void TGo4BrowserProxy::RequestObjectStatus(const char* name, TGo4Slot* tgtslot)
627 {
628  TString objname;
629  TGo4ServerProxy* an = DefineAnalysisObject(name, objname);
630  if (an!=0) an->RequestObjectStatus(objname.Data(), tgtslot);
631 }
632 
633 void TGo4BrowserProxy::PerformTreeDraw(const char* treename,
634  const char* Xexp,
635  const char* Yexp,
636  const char* Zexp,
637  const char* cutcond,
638  const char* hname,
639  TString& createdhistoname)
640 {
641  if (strlen(Xexp)==0) return;
642 
643  TString varexp(Xexp);
644 
645  if(strlen(Yexp)>0) {
646  varexp = TString(Yexp) + TString(":") + varexp;
647  if(strlen(Zexp)>0)
648  varexp = TString(Zexp) + TString(":") + varexp;
649  }
650 
651  int drawdim = varexp.CountChar(':') + 1;
652  if (drawdim>3) drawdim = 3;
653 
654 
655  if (IsItemRemote(treename)) {
656  TString objname;
657  TGo4ServerProxy* an = DefineAnalysisObject(treename, objname);
658  if (an!=0) {
659  TString analhname(hname);
660 
661  Int_t cnt = 0;
662  TString anitem = "abcdef";
663  if (analhname.Length()==0)
664  while (anitem.Length()>0) {
665  analhname = "hTreeDraw";
666  if (cnt>0) { analhname+="_"; analhname+=cnt; }
667  cnt++;
668  anitem = FindItemInAnalysis(analhname.Data());
669  }
670 
671  an->RemoteTreeDraw(objname.Data(), varexp.Data(), cutcond, analhname.Data());
673  }
674 
675  createdhistoname = "";
676 
677  return;
678  }
679 
680  // take tree directly from data browser while
681  // tree pointer is not stored in browser slots
682  TString treeslotname;
683  DataSlotName(treename, treeslotname);
684  TTree* SelectedTree = dynamic_cast<TTree*> (fxOM->GetObject(treeslotname.Data()));
685  if (SelectedTree==0) return;
686 
687  TString histoname(hname), hslotname;
688  BrowserSlotName(hname, hslotname);
689  TGo4Slot* hslot = fxOM->GetSlot(hslotname.Data());
690 
691  TH1* histo = 0;
692 
693  if ((hslot!=0) && !IsItemRemote(hslot)) {
694  histo = dynamic_cast<TH1*> (GetBrowserObject(hname, 1));
695  if ((histo!=0) && (drawdim!=histo->GetDimension())) {
696  histo = 0;
697  histoname = "";
698  }
699  }
700 
701  // find non used entry in memory subfolder
702  int cnt = 0;
703  if ((histo==0) && (histoname.Length()==0))
704  do {
705  histoname = fxMemoryPath;
706  histoname += "/hTreeDraw_";
707  histoname += cnt++;
708  BrowserSlotName(histoname, hslotname);
709  hslot = fxOM->GetSlot(hslotname.Data());
710  } while (hslot!=0);
711 
712  TString hfoldername, hobjectname;
713  TGo4Slot::ProduceFolderAndName(histoname.Data(), hfoldername, hobjectname);
714 
715  if (histo!=0)
716  hobjectname = histo->GetName();
717 
718  varexp += ">>+";
719  varexp += hobjectname;
720 
721  TDirectory* oldhisdir = histo ? histo->GetDirectory() : 0;
722  TDirectory* savdir = gDirectory;
723  gDirectory = 0;
724  TDirectory dummydir("DummyTreeDraw","Dummy directory to call tree draw");
725  dummydir.cd();
726  if (histo!=0)
727  histo->SetDirectory(&dummydir);
728 
729  SelectedTree->Draw(varexp, cutcond, "goff", 10000000, 0);
730 
731  if (histo==0) { // when new histogram created by Tree::Draw
732  histo = dynamic_cast<TH1*> (dummydir.FindObject(hobjectname));
733  if(histo!=0) {
734  histo->SetDirectory(0);
735  createdhistoname = SaveToMemory(0, histo, kTRUE);
736  // do sync immediately to be able draw this item in viewpanel
738  }
739  } else {
740  histo->SetDirectory(oldhisdir);
741  TGo4Slot* brslot = BrowserSlot(hname);
742  if (brslot!=0) brslot->ForwardEvent(brslot, TGo4Slot::evObjUpdated);
743  }
744  dummydir.Clear();
745  savdir->cd();
746 
747  #if ROOT_VERSION_CODE < ROOT_VERSION(5,13,1)
748 
749  // this replace fgCurrent member in TVirtualTreePlayer,
750  // problem was fixed starting from ROOT version 5.13/01
751  if (fDummyTreePlayer!=0) delete fDummyTreePlayer;
752  fDummyTreePlayer = TVirtualTreePlayer::TreePlayer(0);
753 
754  #endif
755 }
756 
757 TGo4Slot* TGo4BrowserProxy::FindServerSlot(Bool_t databranch, Int_t kind)
758 {
759  // search for slot with TGo4ServerProxy
760  // kind = 0 - should be TGo4AnalysisProxy (default)
761  // kind = 1 - should be TGo4ServerProxy and IsGo4Analysis() == kTRUE
762  // kind = 2 - should be TGo4ServerProxy
763 
764  TGo4Slot* dataslot = fxOM->GetSlot(fxDataPath.Data());
765 
766  TGo4Iter iter(dataslot, kTRUE);
767  TGo4Slot* res = 0;
768 
769  while (iter.next()) {
770 
771  TGo4Slot* slot = iter.getslot();
772  if (slot==0) continue;
773 
774  if (kind > 0) {
775  TGo4ServerProxy* serv = dynamic_cast<TGo4ServerProxy*> (slot->GetProxy());
776  if ((serv==0) || ((kind==1) && !serv->IsGo4Analysis())) continue;
777  } else {
778  if (dynamic_cast<TGo4AnalysisProxy*>(slot->GetProxy())==0) continue;
779  }
780 
781  res = slot;
782  break;
783  }
784 
785  if ((res!=0) && !databranch) {
786  TString itemname;
787  res->ProduceFullName(itemname, dataslot);
788  res = BrowserSlot(itemname.Data());
789  }
790 
791  return res;
792 }
793 
795 {
796  TString slotname;
797  DataSlotName(itemname, slotname);
798 
799  TGo4Slot* slot = fxOM->FindSlot(slotname.Data());
800  if ((slot==0) || (itemname==0))
801  slot = FindServerSlot(kTRUE);
802 
803  return slot==0 ? 0 : dynamic_cast<TGo4AnalysisProxy*>(slot->GetProxy());
804 }
805 
806 TGo4ServerProxy* TGo4BrowserProxy::FindServer(const char* itemname, Bool_t asanalysis)
807 {
808  // method should be used when analysis can be used via TGo4ServerProxy interface
809 
810  TString slotname;
811  DataSlotName(itemname, slotname);
812 
813  TGo4Slot* slot = fxOM->FindSlot(slotname.Data());
814  if ((slot==0) || (itemname==0))
815  slot = FindServerSlot(kTRUE, asanalysis ? 1 : 2);
816 
817  return slot==0 ? 0 : dynamic_cast<TGo4ServerProxy*>(slot->GetProxy());
818 }
819 
820 TString TGo4BrowserProxy::FindItemInAnalysis(const char* objname)
821 {
822  TGo4Slot* analslot = FindServerSlot(kTRUE);
823  if ((analslot==0) || (objname==0)) return TString("");
824 
825  TGo4Iter iter(analslot);
826  while (iter.next()) {
827  if (strcmp(iter.getname(), objname)!=0) continue;
828  TString res;
829  analslot->ProduceFullName(res, DataSlot(""));
830  res+="/";
831  res+=iter.getfullname();
832  return res;
833  }
834 
835  return TString("");
836 }
837 
838 TString TGo4BrowserProxy::FindItem(const char* objname)
839 {
840  TGo4Slot* topslot = BrowserTopSlot();
841  if ((topslot==0) || (objname==0)) return TString("");
842 
843  TGo4Iter iter(topslot);
844  while (iter.next())
845  if (strcmp(iter.getname(), objname)==0)
846  return iter.getfullname();
847 
848  return TString("");
849 }
850 
852 {
853  TGo4Slot* slot = DataSlot(itemname);
854  if (slot==0) return 0;
855 
856  while (slot!=0) {
857  TGo4ServerProxy* pr = dynamic_cast<TGo4ServerProxy*> (slot->GetProxy());
858  if (pr!=0) return pr;
859  slot = slot->GetParent();
860  }
861 
862  return 0;
863 }
864 
865 TGo4ServerProxy* TGo4BrowserProxy::DefineServerObject(const char* itemname, TString* objname, Bool_t onlyanalysis)
866 {
867  TString slotname;
868  DataSlotName(itemname, slotname);
869  const char* objectname = 0;
870 
871  TGo4Slot* servslot = fxOM->FindSlot(slotname.Data(), &objectname);
872 
873  TGo4ServerProxy* serv = servslot==0 ? 0 :
874  dynamic_cast<TGo4ServerProxy*>(servslot->GetProxy());
875  if (serv==0) return 0;
876  if (onlyanalysis && !serv->IsGo4Analysis()) return 0;
877  if (objname!=0) *objname = objectname;
878  return serv;
879 }
880 
881 TGo4ServerProxy* TGo4BrowserProxy::DefineAnalysisObject(const char* itemname, TString& analysisname)
882 {
883  return DefineServerObject(itemname, &analysisname, kTRUE);
884 }
885 
886 Bool_t TGo4BrowserProxy::UpdateAnalysisItem(const char* itemname, TObject* obj)
887 {
888  TGo4Slot* slot = BrowserSlot(itemname);
889  if (slot==0) return kFALSE;
890 
891  if (obj==0) obj = GetBrowserObject(itemname, 0);
892  if (obj==0) return kFALSE;
893 
894  const char* analysisname = 0;
895  TGo4Slot* anslot = 0;
896  TString slotname;
897 
898  if (IsItemRemote(itemname)) {
899  DataSlotName(itemname, slotname);
900  anslot = fxOM->FindSlot(slotname.Data(), &analysisname);
901  }
902 
903  if (anslot==0) {
904  analysisname = 0;
905  anslot = FindServerSlot(kTRUE, 1);
906  }
907 
908  TGo4ServerProxy* serv = dynamic_cast<TGo4ServerProxy*>(anslot->GetProxy());
909  if (serv!=0) return serv->UpdateAnalysisObject(analysisname, obj);
910 
911  return kFALSE;
912 
913 }
914 
915 void TGo4BrowserProxy::FetchItem(const char* itemname, Int_t wait_time)
916 {
917  TGo4Slot* itemslot = ItemSlot(itemname);
918  if (itemslot==0) return;
919 
920  if (ItemKind(itemslot)==TGo4Access::kndObject)
921  RequestBrowserObject(itemslot, wait_time);
922 
923  TGo4Iter iter(itemslot, kTRUE);
924  while (iter.next()) {
925  TGo4Slot* subslot = iter.getslot();
926  if (ItemKind(subslot)==TGo4Access::kndObject)
927  RequestBrowserObject(subslot, wait_time);
928  }
929 
930  if (wait_time==0) return;
931 }
932 
933 void TGo4BrowserProxy::RedrawItem(const char* itemname)
934 {
935  TGo4Slot* slot = BrowserSlot(itemname);
936  if (slot!=0) {
938  SetItemTimeDate(slot);
939  }
940 }
941 
942 TObject* TGo4BrowserProxy::GetBrowserObject(const char* name, int update)
943 // update=0 - without update,
944 // 1 - request only if obj==0,
945 // 2 - update of object in any case
946 // >=100 - update object in any case and wait for specified time in millisec
947 {
948  if ((name==0) || (fxBrowserSlot==0) || (fxOM==0)) return 0;
949 
950  TString src, tgt;
951  BrowserSlotName(name, tgt);
952  TGo4Slot* guislot = fxOM->GetSlot(tgt.Data());
953 
954  if (guislot==0) return 0;
955 
956  TObject* obj = guislot->GetAssignedObject();
957 
958  if ((update==0) || ((update==1) && (obj!=0))) return obj;
959 
960  if (guislot->IsParent(BrowserMemorySlot())) return obj;
961 
962  DataSlotName(name, src);
963 
964  fxOM->RequestObject(src.Data(), tgt.Data(), (update<10) ? 0 : update);
965 
966  return guislot->GetAssignedObject();
967 }
968 
970 {
971  fiFilterIndex = filter;
973 }
974 
976 {
977  if (fxBrowserSlot!=0)
979 }
980 
982 {
983  if ((itemslot==0) || (fxBrowserSlot==0) || (fxOM==0)) return kFALSE;
984 
985  Int_t cando = ItemCanDo(itemslot);
986 
987  Bool_t ismemoryitem = itemslot->IsParent(BrowserMemorySlot());
988 
989  if (!ismemoryitem && !CanCloseItem(cando) && !IsCanDelete(itemslot)) return kFALSE;
990 
991  if (itemslot->GetPar("::CopyObject")!=0) {
992  delete itemslot;
994  } else {
995  TString name = itemslot->GetFullName(fxBrowserSlot);
996  TString src;
997  DataSlotName(name.Data(), src);
998  fxOM->DeleteSlot(src.Data());
999  }
1000  return kTRUE;
1001 }
1002 
1004 {
1005  if ((slot==0) || (!slot->IsParent(fxBrowserSlot))) return;
1006 
1007  slot->Update(kFALSE);
1008 }
1009 
1010 
1012 {
1013  return fxBrowserSlot;
1014 }
1015 
1016 TGo4Slot* TGo4BrowserProxy::ItemSlot(const char* itemname)
1017 {
1018  TString slotname;
1019  BrowserSlotName(itemname, slotname);
1020  return fxOM->GetSlot(slotname.Data());
1021 }
1022 
1023 
1024 Bool_t TGo4BrowserProxy::DefineTreeName(const char* itemname, TString& treename)
1025 {
1026  TString slotname;
1027  BrowserSlotName(itemname, slotname);
1028  TGo4Slot* slot = fxOM->GetSlot(slotname.Data());
1029  if (slot==0) return kFALSE;
1030 
1031  TGo4Slot* treeslot = slot;
1032  while (treeslot!=0) {
1033  TClass* cl = ItemClass(treeslot);
1034  if ((cl!=0) && (cl->InheritsFrom(TTree::Class()))) break;
1035  treeslot = treeslot->GetParent();
1036  }
1037  if (treeslot==0) return kFALSE;
1038 
1039  treeslot->ProduceFullName(treename, fxBrowserSlot);
1040 
1041  return kTRUE;
1042 }
1043 
1044 Bool_t TGo4BrowserProxy::DefineLeafName(const char* itemname, const char* treename, TString& leafname)
1045 {
1046  if ((itemname==0) || (treename==0)) return kFALSE;
1047 
1048  TString slotname;
1049  BrowserSlotName(itemname, slotname);
1050  TGo4Slot* slot = fxOM->GetSlot(slotname.Data());
1051  if (slot==0) return kFALSE;
1052 
1053  printf("DefineLeafName %s %s kind :%d\n", itemname, treename, ItemKind(slot));
1054 
1055  if (ItemKind(slot)!=TGo4Access::kndTreeLeaf) return kFALSE;
1056 
1057  int ilen = strlen(itemname);
1058  int tlen = strlen(treename);
1059  if ((ilen<tlen) || (strncmp(itemname, treename, tlen)!=0)) return kFALSE;
1060 
1061  leafname = slot->GetName();
1062  return kTRUE;
1063 }
1064 
1065 Bool_t TGo4BrowserProxy::DefineRelatedObject(const char* itemname, const char* objname, TString& objectitem, Int_t mask)
1066 {
1067  if ((objname==0) || (*objname==0)) return kFALSE;
1068 
1069  if (BrowserSlot(objname)!=0) {
1070  objectitem = objname;
1071  return kTRUE;
1072  }
1073 
1074  TGo4Slot* picslot = BrowserSlot(itemname);
1075 
1076  if (picslot!=0) {
1077  TGo4Slot* searchslot = picslot->GetParent();
1078 
1079  while ((searchslot!=0) && (searchslot!=fxBrowserSlot)) {
1080  TString searchname;
1081  searchslot->ProduceFullName(searchname, fxBrowserSlot);
1082  if (*objname!='/') searchname+="/";
1083  searchname+=objname;
1084 
1085  TString fullname;
1086  BrowserSlotName(searchname.Data(), fullname);
1087 
1088  TGo4Slot* slot = fxOM->GetSlot(searchname.Data());
1089  if (slot==0) {
1090  searchname.Append(";1");
1091  slot = fxOM->GetSlot(searchname.Data());
1092  }
1093 
1094  if (slot!=0) {
1095  objectitem = searchname;
1096  return kTRUE;
1097  }
1098 
1099  searchslot = searchslot->GetParent();
1100  }
1101  }
1102 
1103  if (strchr(objname,'/')!=0) {
1104  // to enable explore missing subfolders, mask should be 2
1105  if ((mask & 2) == 0) return kFALSE;
1106 
1107  // it could happen that folder in the file or remote server is not yet read
1108  // we could try to exploit it
1109 
1110  // first slash should be always there - any source should provide first level by default
1111  const char *slash = strchr(objname, '/');
1112 
1113  while (slash != 0) {
1114  slash = strchr(slash+1, '/');
1115  if (slash == 0) break;
1116 
1117  TString diritem;
1118  if (!DefineRelatedObject(itemname, TString(objname, slash-objname).Data(), diritem, 0)) break;
1119 
1120  int kind = ItemKind(diritem.Data());
1121 
1122  if ((kind==TGo4Access::kndFolder) || (kind==TGo4Access::kndMoreFolder)) {
1123  GetBrowserObject(diritem.Data(), 1000);
1124  SyncBrowserSlots();
1125  }
1126  }
1127 
1128  return DefineRelatedObject(itemname, objname, objectitem, 0);
1129  }
1130 
1131  // one should specify mask==1 to enable recursive search
1132  if ((mask & 1) == 0) return kFALSE;
1133 
1134  TGo4Slot* searchslot = picslot ? picslot->GetParent() : fxBrowserSlot;
1135 
1136  do {
1137  TGo4Iter iter(searchslot, kTRUE);
1138  size_t len = strlen(objname);
1139  while (iter.next()) {
1140  const char* name = iter.getname();
1141 
1142  if (strncmp(objname, name, len)!=0) continue;
1143 
1144  if ((strlen(name) == len) ||
1145  ((strlen(name)==(len+2)) && (strcmp(name+len,";1")==0))) {
1146  TGo4Slot* subslot = iter.getslot();
1147  subslot->ProduceFullName(objectitem, fxBrowserSlot);
1148  return kTRUE;
1149  }
1150  }
1151  if (searchslot == fxBrowserSlot) break;
1152  searchslot = searchslot->GetParent();
1153  } while (searchslot!=0);
1154 
1155  return kFALSE;
1156 }
1157 
1158 Bool_t TGo4BrowserProxy::DefineFileObject(const char* itemname, TString& fitemname, const char** filepath)
1159 {
1160  TGo4Slot* slot = BrowserSlot(itemname);
1161  if (slot==0) return kFALSE;
1162 
1163  if (slot->GetAssignedObject()==0) return kFALSE;
1164 
1165  while (slot!=fxBrowserSlot) {
1166  TClass* cl = ItemClass(slot);
1167  if ((cl!=0) && (cl->InheritsFrom(TFile::Class()))) break;
1168  slot = slot->GetParent();
1169  }
1170  if (slot==fxBrowserSlot) return kFALSE;
1171 
1172  fitemname = "";
1173  slot->ProduceFullName(fitemname, fxBrowserSlot);
1174 
1175  *filepath = itemname + fitemname.Length();
1176  if (**filepath=='/') (*filepath)++;
1177 
1178  //filedataslot = fitemname;
1179  //DataSlotName(fitemname, filedataslot);
1180 
1181  return kTRUE;
1182 }
1183 
1184 Bool_t TGo4BrowserProxy::UpdateObjectInFile(const char* itemname, const char* fileitemname, const char* filepath)
1185 {
1186  TGo4Slot* slot = BrowserSlot(itemname);
1187  if (slot==0) return kFALSE;
1188 
1189  TObject* obj = slot->GetAssignedObject();
1190  if (obj==0) return kFALSE;
1191 
1192  TGo4Slot* fileslot = DataSlot(fileitemname);
1193  if (fileslot==0) return kFALSE;
1194 
1195  TGo4DirProxy* dircont = dynamic_cast<TGo4DirProxy*> (fileslot->GetProxy());
1196  if (dircont==0) return kFALSE;
1197 
1198  Bool_t res = dircont->UpdateObjectInFile(filepath, obj);
1199 
1200  if(res)
1201  fileslot->ForwardEvent(fileslot, TGo4Slot::evObjUpdated);
1202 
1203  return res;
1204 }
1205 
1206 Bool_t TGo4BrowserProxy::SaveItemToFile(const char* itemname, const char* filename, const char* subfolder)
1207 {
1208  TGo4Slot* slot = BrowserSlot(itemname);
1209  if (slot==0) return kFALSE;
1210 
1211  TObject* obj = slot->GetAssignedObject();
1212  if (obj==0) return kFALSE;
1213 
1214  TFile* f = TFile::Open(filename,"UPDATE");
1215  if (f==0) return kFALSE;
1216 
1217  TDirectory* dir = f;
1218 
1219  if ((subfolder!=0) && (*subfolder!=0)) {
1220  dir = dynamic_cast<TDirectory*> (f->Get(subfolder));
1221  if (dir==0) dir = f;
1222  }
1223 
1224  dir->cd();
1225  bool res = dir->WriteTObject(obj, obj->GetName(), "Overwrite") > 0;
1226 
1227  if (obj->InheritsFrom(TH1::Class()))
1228  ((TH1*) obj)->SetDirectory(0);
1229 
1230  delete f;
1231 
1232  return res;
1233 }
1234 
1235 void TGo4BrowserProxy::ExportItemsTo(TObjArray* items, // array of TObjString
1236  Bool_t fetchitems,
1237  const char* filename,
1238  const char* filedir,
1239  const char* format,
1240  const char* description)
1241 {
1242  if ((items==0) || (items->GetSize()==0)) return;
1243 
1244  TString convert;
1245  if(format==0)
1246  convert="ROOT";
1247  else
1248  convert=format;
1249 
1250  Go4Export_t filter;
1251  if(convert.Contains("ASCII")) {
1252  TGo4Log::Message(0,"Export filter is ASCII");
1253  filter=GO4EX_ASCII;
1254  } else
1255  if (convert.Contains("Radware")) {
1256  TGo4Log::Message(0,"Export filter is Radware");
1257  filter=GO4EX_RADWARE;
1258  } else
1259  if (convert.Contains("ROOT XML")) {
1260  TGo4Log::Message(0,"Export filter is ROOT XML");
1261  filter=GO4EX_XML;
1262  } else
1263  if (convert.Contains("ROOT")) {
1264  TGo4Log::Message(0,"Export filter is ROOT");
1265  filter=GO4EX_ROOT;
1266  } else {
1267  TGo4Log::Message(0,"Export filter is unknown, using ROOT");
1268  filter=GO4EX_ROOT;
1269  }
1270 
1271  // if root export filter and 1 subfolder, export with complete file structures
1272  if (((filter==GO4EX_ROOT) || (filter==GO4EX_XML)) && (items->GetLast()==0)) {
1273  TObjString* str = dynamic_cast<TObjString*> (items->At(0));
1274 
1275  TGo4Slot* itemslot = (str==0) ? 0 : ItemSlot(str->GetName());
1276 
1277  TString fname = filename;
1278 
1279  if (filter==GO4EX_XML) {
1280  if(!fname.Contains(".xml")) fname.Append(".xml");
1281  } else {
1282  if(!fname.Contains(".root")) fname.Append(".root");
1283  }
1284 
1285  if ((itemslot!=0) && (itemslot->NumChilds()>0)) {
1286  SaveBrowserToFile(fname.Data(), fetchitems, str->GetName(), description);
1287  return;
1288  }
1289  }
1290 
1291  TGo4ExportManager exman("BrowserExport");
1292  exman.SetOutFile(filename);
1293  exman.SetOutFileComment(description);
1294  exman.SetStartDir();
1295  exman.SetCurrentDir(filedir);
1296 
1297  TGo4Log::Message(1,"Exporting selected browser objects to %s",convert.Data());
1298 
1299  TObjArray objs;
1300  for (int n=0;n<=items->GetLast();n++) {
1301  TObjString* str = dynamic_cast<TObjString*> (items->At(n));
1302  if (str==0) continue;
1303  TObject* obj = GetBrowserObject(str->GetName(), 0);
1304  if (obj==0)
1305  obj = GetBrowserObject(str->GetName(), 2000);
1306 
1307  if (obj!=0) objs.Add(obj);
1308  }
1309 
1310  exman.Export(&objs, filter);
1311 }
1312 
1313 Bool_t TGo4BrowserProxy::SaveBrowserToFile(const char* filename,
1314  Bool_t prefetch,
1315  const char* selectedpath,
1316  const char* description)
1317 {
1318  TGo4Slot* toppath = BrowserSlot(selectedpath);
1319 
1320  if (toppath==0) return kFALSE;
1321 
1322  if (prefetch)
1323  FetchItem(selectedpath, 2000);
1324 
1325  TFile* f = TFile::Open(filename, "recreate", description);
1326  if (f==0) return kFALSE;
1327 
1328  fxOM->SaveDataToFile(f, kTRUE, toppath);
1329 
1330  delete f;
1331 
1332  return kTRUE;
1333 }
1334 
1335 Bool_t TGo4BrowserProxy::IsItemRemote(const char* name)
1336 {
1337  return IsItemRemote(ItemSlot(name));
1338 }
1339 
1341 {
1342  if (slot==0) return kFALSE;
1343  Int_t remote;
1344  if (!slot->GetIntPar("GUI::Remote", remote)) return kFALSE;
1345  return remote!=0;
1346 }
1347 
1348 Bool_t TGo4BrowserProxy::IsAnalysisItem(const char* name)
1349 {
1350  TString analysisname;
1351  return DefineAnalysisObject(name, analysisname)!=0;
1352 }
1353 
1354 void TGo4BrowserProxy::SetItemTimeDate(TGo4Slot* slot, const char* stime, const char* sdate)
1355 {
1356  if ((stime!=0) && (sdate!=0)) {
1357  slot->SetPar("GUI::Time", stime);
1358  slot->SetPar("GUI::Date", sdate);
1359  return;
1360  }
1361 
1362  TDatime t;
1363  const char* datetime = t.AsSQLString();
1364  char* time = (char*) strchr(datetime, ' ');
1365  if (time==0) {
1366  slot->SetPar("GUI::Time",datetime);
1367  slot->SetPar("GUI::Date",datetime);
1368  } else {
1369  slot->SetPar("GUI::Time", time+1);
1370  *time = 0;
1371  slot->SetPar("GUI::Date", datetime);
1372  }
1373 }
1374 
1376 {
1377  return slot==0 ? 0 : slot->GetPar("GUI::Time");
1378 }
1379 
1381 {
1382  return slot==0 ? 0 : slot->GetPar("GUI::Date");
1383 }
1384 
1385 void TGo4BrowserProxy::SetLinkedName(TGo4Slot* slot, const char* itemname)
1386 {
1387  if (slot!=0)
1388  slot->SetPar("::LinkedItem", itemname);
1389 }
1390 
1392 {
1393  return (slot==0) ? 0 : slot->GetPar("::LinkedItem");
1394 }
1395 
1396 Int_t TGo4BrowserProxy::ItemKind(const char* name)
1397 {
1398  return ItemKind(ItemSlot(name));
1399 }
1400 
1402 {
1403  if (slot==0) return TGo4Access::kndNone;
1404  Int_t kind;
1405  if (!slot->GetIntPar("GUI::Kind", kind)) return TGo4Access::kndNone;
1406  return kind;
1407 }
1408 
1409 void TGo4BrowserProxy::SetItemKind(TGo4Slot* slot, Int_t kind, const char* classname, const char* info, Int_t sizeinfo)
1410 {
1411  if (slot==0) return;
1412  if (kind>=0) slot->SetIntPar("GUI::Kind", kind);
1413  else slot->RemovePar("GUI::Kind");
1414  slot->SetPar("GUI::Class", classname);
1415  slot->SetPar("GUI::Info", info);
1416  slot->SetIntPar("GUI::SizeInfo", sizeinfo);
1417 }
1418 
1420 {
1421  return slot==0 ? 0 : slot->GetPar("GUI::Info");
1422 }
1423 
1425 {
1426  if (slot==0) return -1;
1427  Int_t sizeinfo;
1428  if (!slot->GetIntPar("GUI::SizeInfo", sizeinfo)) return -1;
1429  return sizeinfo;
1430 }
1431 
1433 {
1434  if (slot!=0)
1435  slot->SetIntPar("GUI::CalcSize", size);
1436 }
1437 
1439 {
1440  if (slot==0) return 0;
1441  Int_t size;
1442  if (!slot->GetIntPar("GUI::CalcSize", size)) return 0;
1443  return size;
1444 }
1445 
1447 {
1448  return TGo4Proxy::GetClass(ItemClassName(slot));
1449 }
1450 
1451 TClass* TGo4BrowserProxy::ItemClass(const char* name)
1452 {
1453  return ItemClass(ItemSlot(name));
1454 }
1455 
1457 {
1458  return slot==0 ? 0 : slot->GetPar("GUI::Class");
1459 }
1460 
1461 const char* TGo4BrowserProxy::ItemClassName(const char* name)
1462 {
1463  return ItemClassName(ItemSlot(name));
1464 }
1465 
1466 Int_t TGo4BrowserProxy::ItemCanDo(const char* name)
1467 {
1468  return ItemCanDo(ItemSlot(name));
1469 }
1470 
1472 {
1473  if (slot==0) return 0;
1474 
1475  Int_t cando;
1476  if (!slot->GetIntPar("GUI::CanDo", cando)) return 0;
1477  return cando;
1478 }
1479 
1481 {
1482  if (slot!=0) slot->SetIntPar("GUI::CanDo", cando);
1483 }
1484 
1486 {
1487  return slot==0 ? kTRUE : slot->GetPar("GUI::NotMonitored")==0;
1488 }
1489 
1491 {
1492  if (slot==0) return;
1493 
1494  if (ItemKind(slot)==TGo4Access::kndFolder) {
1495  TGo4Iter iter(slot, kTRUE);
1496  while (iter.next()) {
1497  TGo4Slot* subslot = iter.getslot();
1498  if (ItemKind(subslot)==TGo4Access::kndObject)
1499  SetItemMonitored(subslot, on);
1500  }
1501  } else {
1502  if (on) {
1503  slot->RemovePar("GUI::NotMonitored");
1504  CheckPictureMonitor(slot);
1505  } else {
1506  slot->SetPar("GUI::NotMonitored","1");
1507  }
1508  }
1509 }
1510 
1512 {
1513  return (cando % 1000000000) / 100000000 > 0;
1514 }
1515 
1517 {
1518  return (cando % 100000000) / 10000000 > 0;
1519 }
1520 
1522 {
1523  return (cando % 10000000) / 1000000 > 0;
1524 }
1525 
1527 {
1528  return (cando % 1000000) / 100000 > 0;
1529 }
1530 
1531 
1533 {
1534  return (cando % 100000) / 10000 > 0;
1535 }
1536 
1538 {
1539  return (cando % 10000) / 1000 > 0;
1540 }
1541 
1543 {
1544  return (cando % 1000) / 100 > 0;
1545 }
1546 
1548 {
1549  return (cando % 100) / 10 > 0;
1550 }
1551 
1553 {
1554  return (cando % 10 > 0);
1555 }
1556 
1557 void TGo4BrowserProxy::CreateMemoryFolder(const char* foldername)
1558 {
1559  if ((foldername!=0) && (*foldername!=0))
1560  fxMemoryPath = foldername;
1561 
1562  TString fullpathname;
1563  DataSlotName(fxMemoryPath, fullpathname);
1564 
1565  fxOM->MakeFolder(fullpathname);
1566 }
1567 
1568 void TGo4BrowserProxy::CreateMemorySubfolder(const char* itemname, const char* newfoldername)
1569 {
1570  TGo4Slot* itemslot = BrowserSlot(itemname);
1571 
1572  if ((itemslot==0) || (newfoldername==0) || (strlen(newfoldername)==0)) return;
1573 
1574  TGo4Slot* memslot = BrowserMemorySlot();
1575  if (!itemslot->IsParent(memslot) && (memslot!=itemslot)) return;
1576 
1577  TGo4Slot* slot = DataSlot(itemname);
1578  if (slot==0) return;
1579 
1580  TGo4Slot* newslot = slot->GetSlot(newfoldername, kTRUE);
1581 
1582  if (newslot!=0)
1584 }
1585 
1586 void TGo4BrowserProxy::RenameMemoryItem(const char* itemname, const char* newname)
1587 {
1588  TGo4Slot* itemslot = BrowserSlot(itemname);
1589  if ((itemslot==0) || (newname==0) || (strlen(newname)==0)) return;
1590 
1591  if ((strchr(newname,'/')!=0) || (strchr(newname,'\\')!=0)) return;
1592 
1593  TGo4Slot* memslot = BrowserMemorySlot();
1594  if (!itemslot->IsParent(memslot)) return;
1595 
1596  TGo4Slot* slot = DataSlot(itemname);
1597  if (slot==0) return;
1598 
1599  // check if item of that name is already existing
1600  if (slot->GetParent()->FindChild(newname)!=0) return;
1601 
1602  slot->SetName(newname);
1603  TNamed* n = dynamic_cast<TNamed*> (slot->GetAssignedObject());
1604  if (n!=0) n->SetName(newname);
1605 
1607 }
1608 
1609 
1610 
1611 void TGo4BrowserProxy::ClearMemoryItem(const char* itemname)
1612 {
1613  TGo4Slot* itemslot = BrowserSlot(itemname);
1614  if (itemslot==0) return;
1615 
1616  TGo4Slot* memslot = BrowserMemorySlot();
1617  if (!itemslot->IsParent(memslot)) return;
1618 
1619  TGo4Slot* slot = DataSlot(itemname);
1620  if (slot==0) return;
1621 
1622  TObject* ob = slot->GetAssignedObject();
1623  if (ob==0) return;
1624 
1625  if(ob->InheritsFrom(TH1::Class())) {
1626  TH1* his = dynamic_cast<TH1*>(ob);
1627  if (his) his->Reset(); // histogram has no Clear implementation!
1628  } else
1629  if(ob->InheritsFrom(TGo4DynamicEntry::Class())) {
1630  TGo4DynamicEntry* entry = dynamic_cast<TGo4DynamicEntry*>(ob);
1631  if (entry) entry->Reset(); // dynamic entry has no Clear implementation!
1632  } else
1633  if(ob->InheritsFrom(TGo4Picture::Class())) {
1634  TGo4Picture* pic = dynamic_cast<TGo4Picture*>(ob);
1635  if (pic) pic->Reset(); // picture has no Clear implementation!
1636  } else
1637  if(ob->InheritsFrom(TGraph::Class())) {
1638  TGraph* gr= dynamic_cast<TGraph*>(ob);
1639  if (gr) {
1640  Int_t pn = gr->GetN();
1641  gr->Set(0); // clear array of points
1642  gr->Set(pn); // this should set all to 0
1643  }
1644  } else
1645  if(ob->InheritsFrom(TMultiGraph::Class())) {
1646  TMultiGraph* mg = dynamic_cast<TMultiGraph*>(ob);
1647  if (mg) {
1648  TIter liter(mg->GetListOfGraphs());
1649  TGraph* gr = 0;
1650  while(( gr = (TGraph*) liter())!=0) {
1651  Int_t pn = gr->GetN();
1652  gr->Set(0); // clear array of points
1653  gr->Set(pn); // this should set all to 0
1654  }
1655  }
1656  } else {
1657  // use virtual Clear of all objects
1658  // make sure that TNamed::Clear is overwritten in subclasses
1659  ob->Clear();
1660  }
1661 
1662  itemslot->ForwardEvent(itemslot, TGo4Slot::evObjAssigned);
1663 }
1664 
1665 TString TGo4BrowserProxy::SaveToMemory(const char* pathname, TObject* obj, Bool_t ownership, Bool_t overwrite)
1666 {
1667  if (obj==0) return TString("");
1668 
1669  TString path = fxMemoryPath;
1670  if ((pathname!=0) && (*pathname!=0)) {
1671  path += "/";
1672  path += pathname;
1673  }
1674 
1675  // if overwrite, check if slot of that name exists
1676  if (overwrite) {
1677  TString itemname = path;
1678  itemname+= "/";
1679  itemname+=obj->GetName();
1680  TGo4Slot* slot = DataSlot(itemname);
1681  if (slot!=0) {
1682  slot->AssignObject(obj, ownership);
1683  return itemname;
1684  }
1685  }
1686 
1687  TString fullpathname;
1688  DataSlotName(path.Data(), fullpathname);
1689 
1690  TGo4Slot* slot = fxOM->Add(fullpathname.Data(), obj, ownership, kTRUE);
1691 
1692  return slot==0 ? TString("") : slot->GetFullName(fxOM->GetSlot(fxDataPath));
1693 }
1694 
1696 {
1697  if (slot==0) return;
1698 
1699  TObject* obj = slot->GetAssignedObject();
1700  if (obj==0) return;
1701 
1702  TGo4Picture* pic = dynamic_cast<TGo4Picture*> (obj);
1703  if (pic==0) return;
1704 
1705  if (!IsItemMonitored(slot)) return;
1706 
1707  TString picitemname;
1708  if (!BrowserItemName(slot, picitemname)) return;
1709 
1710  CheckPictureMonitor(pic, picitemname.Data());
1711 }
1712 
1713 void TGo4BrowserProxy::CheckPictureMonitor(TGo4Picture* pic, const char* picitemname)
1714 {
1715  if (pic==0) return;
1716  if (pic->IsDivided())
1717  for(Int_t posy=0; posy<pic->GetDivY(); posy++)
1718  for(Int_t posx=0; posx<pic->GetDivX(); posx++)
1719  CheckPictureMonitor(pic->FindPic(posy,posx), picitemname);
1720 
1721  for (Int_t n=0; n<pic->GetNumObjNames(); n++) {
1722 
1723  TString drawname;
1724 
1725  if (DefineRelatedObject(picitemname, pic->GetObjName(n), drawname))
1726  SetItemMonitored(BrowserSlot(drawname), kTRUE);
1727  }
1728 }
1729 
1731 {
1732  TIter iter(gROOT->GetList());
1733  TObject* obj = 0;
1734  while ((obj=iter())!=0) {
1735  SaveToMemory("gROOT", obj, kTRUE);
1736  }
1737 
1738  gROOT->GetList()->Clear();
1739 }
1740 
1742 {
1743  if (slot!=0){
1744  if(on) slot->SetPar("GUI::CanDelete","1");
1745  else slot->RemovePar("GUI::CanDelete");
1746  }
1747 }
1748 
1750 {
1751  return slot==0 ? kFALSE : slot->GetPar("GUI::CanDelete")!=0;
1752 }
1753 
1755 {
1756  fiMonitoringPeriod = rate;
1757 
1758  fbBlockMonitoring = kFALSE;
1759 
1760  if (fiMonitoringPeriod>0) {
1761  if (fxMonitorTimer==0)
1762  fxMonitorTimer = new TTimer(this, 10, kTRUE);
1763  fxMonitorTimer->Start(10, kTRUE);
1764  } else {
1765  if (fxMonitorTimer!=0) fxMonitorTimer->Reset();
1766  delete fxMonitorTimer;
1767  fxMonitorTimer = 0;
1768  }
1769 
1771 }
1772 
1774 {
1775  TGo4Slot* viewslot = fxOM->GetSlot(fxViewPath.Data());
1776  if (viewslot==0) return 0;
1777 
1778  TGo4Slot* brslot = BrowserSlot(0);
1779 
1780  TObjArray UniqueItems;
1781 
1782  // first produce list of slots without duplication
1783  TGo4Iter iter(viewslot, kTRUE);
1784  while (iter.next()) {
1785  TGo4Slot* subslot = iter.getslot();
1786 
1787  TGo4LinkProxy* link = dynamic_cast<TGo4LinkProxy*> (subslot->GetProxy());
1788  if (link!=0) {
1789  TGo4Slot* srcslot = link->GetLink();
1790  if ((srcslot!=0) && srcslot->IsParent(brslot) &&
1791  (UniqueItems.FindObject(srcslot)==0))
1792  UniqueItems.Add(srcslot);
1793  }
1794  }
1795 
1796  Int_t nrequests = 0;
1797  for (int n=0;n<=UniqueItems.GetLast();n++) {
1798  TGo4Slot* srcslot = (TGo4Slot*)UniqueItems.At(n);
1799  if (!checkmonitor || IsItemMonitored(srcslot)) {
1800  nrequests++;
1801  srcslot->Update(kFALSE);
1802  }
1803  }
1804  return nrequests;
1805 }
1806 
1808 {
1809  Int_t nrequests = 0;
1810 
1811  TGo4Iter iter(BrowserSlot(0),kTRUE);
1812 
1813  while (iter.next()) {
1814  TGo4Slot* subslot = iter.getslot();
1815  if (IsItemMonitored(subslot)) {
1816  nrequests++;
1817  subslot->Update(kTRUE);
1818  }
1819  }
1820 
1821  return nrequests;
1822 }
1823 
1824 Bool_t TGo4BrowserProxy::HandleTimer(TTimer* timer)
1825 {
1826  if (timer==fxSyncTimer) {
1827  SyncBrowserSlots();
1828  return kTRUE;
1829  } else
1830 
1831  if (timer == fxMonitorTimer) {
1832 
1833  if (fiMonitoringPeriod<=0) return kTRUE;
1834 
1835  TGo4ServerProxy* an = FindServer();
1836 
1837  Bool_t anready = kTRUE;
1838  if (an!=0) anready = an->IsConnected() && (an->NumberOfWaitingProxyes()<3);
1839 
1840  // request new objects if total number of proxies is not too big
1841  if (anready && !fbBlockMonitoring) {
1842  if (fbWithRootBrowser) {
1845  } else {
1847  }
1848  }
1849 
1850  Int_t period = fiMonitoringPeriod;
1851 
1852  // if monitoring is blocked (no request for objects update are called), check again quickly
1853  if (fbBlockMonitoring) period = 1000;
1854 
1855  fxMonitorTimer->Start(period, kTRUE);
1856 
1857  return kTRUE;
1858  }
1859 
1860  return kFALSE;
1861 }
1862 
1863 void TGo4BrowserProxy::SetProtectionBits(TGo4Slot* slot, Int_t delprot, Int_t clearprot)
1864 {
1865  if (slot==0) return;
1866  if (delprot>=0)
1867  slot->SetIntPar("GUI::DeleteProtect", delprot);
1868  else
1869  slot->RemovePar("GUI::DeleteProtect");
1870  if (clearprot>=0)
1871  slot->SetIntPar("GUI::ResetProtect", clearprot);
1872  else
1873  slot->RemovePar("GUI::ResetProtect");
1874 }
1875 
1876 void TGo4BrowserProxy::GetProtectionBits(TGo4Slot* slot, Int_t& delprot, Int_t& clearprot)
1877 {
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;
1882 }
1883 
1885 {
1886  TGo4LockGuard lock;
1887 
1888  TGo4Slot* targetslot = BrowserTopSlot();
1889 
1890  TGo4Slot* source = fxOM->GetSlot(fxDataPath.Data());
1891  if (source==0) return;
1892 
1893  TGo4Slot* curfold = targetslot;
1894  if (curfold==0) return;
1895 
1896  TGo4Slot* curslot = curfold->GetChild(0);
1897 
1898  TGo4Iter iter(source);
1899 
1900  const char* EventsFolder = "EventObjects/Events/";
1901 
1902  while (curfold!=0) {
1903 
1904  // shift to next item in iterator
1905  Bool_t res = iter.next();
1906 
1907  // go to top folders and remove rest items
1908  Int_t levelchange = iter.levelchange();
1909 // std::cout << " " << iter.getname() << " levelchange = " << levelchange << std::endl;
1910 
1911  while (levelchange++<0) {
1912  while (curslot!=0) {
1913  TGo4Slot* next = curslot->GetNext();
1914  delete curslot;
1915  curslot = next;
1916  }
1917 
1918  curslot = curfold->GetNext();
1919  curfold = curfold->GetParent();
1920  if (curfold==0) break;
1921 // std::cout << "cd .. ; folder = " << curfold->GetName() << std::endl;
1922  }
1923 
1924  if (!res) break;
1925 
1926 
1927  TGo4Slot* find = curslot;
1928  while ((find!=0) && (strcmp(iter.getname(), find->GetName())!=0))
1929  find = find->GetNext();
1930 
1931  if (find==0)
1932  find = new TGo4Slot(curfold, iter.getname(), iter.getinfo());
1933 
1934  if (find!=curslot) {
1935  curfold->ShiftSlotBefore(find, curslot);
1936  curslot = find;
1937  }
1938 
1939  Int_t kind = iter.getkindofitem();
1940  const char* classname = iter.getclassname();
1941  const char* fullname = iter.getfullname();
1942  const char* ppp = strstr(fullname, EventsFolder);
1943  if (ppp!=0) {
1944  ppp += strlen(EventsFolder);
1945  if ((strlen(ppp)!=0) && (strchr(ppp,'/')==0)) {
1947  classname = 0;
1948  }
1949  }
1950 
1951  SetItemKind(curslot, kind, classname, iter.getinfo(), iter.getsizeinfo());
1952  curslot->SetIntPar("GUI::Remote", iter.getflag("IsRemote")==1);
1953  SetProtectionBits(curslot, iter.getflag("IsDeleteProtect"), iter.getflag("IsResetProtect"));
1954 
1955  if (iter.getslot()!=0)
1956  SetCanDelete(curslot, IsCanDelete(iter.getslot()));
1957 
1958  TObject* assobj = 0;
1959  if ((kind==TGo4Access::kndObject) && (iter.getslot()!=0)) {
1960  TObject* obj = iter.getslot()->GetAssignedObject();
1961  if ((obj!=0) && (curslot->GetAssignedObject()==0))
1962  assobj = obj;
1963  }
1964 
1965  if (curslot->GetProxy()==0)
1966  curslot->SetProxy(new TGo4BrowserObjProxy(curslot, assobj, kFALSE));
1967  else
1968 
1969  if (assobj!=0)
1970  curslot->AssignObject(assobj, kFALSE);
1971 
1972  if (iter.isfolder()) {
1973  curfold = curslot;
1974 // std::cout << "cd ++ ; folder = " << curfold->GetName() << std::endl;
1975  curslot = curfold->GetChild(0);
1976  } else {
1977  curslot->DeleteChilds();
1978  curslot = curslot->GetNext();
1979  }
1980  }
1981 
1982  if ((curslot!=0) && curslot->IsParent(targetslot))
1983  while (curslot!=0) {
1984  TGo4Slot* next = curslot->GetNext();
1985  delete curslot;
1986  curslot = next;
1987  }
1988 
1989  CalculateFolderSizes(targetslot);
1990 
1991  // inform other world that content was updated
1992  targetslot->ForwardEvent(targetslot, TGo4Slot::evObjUpdated);
1993 
1994  if (fxSyncTimer!=0) fxSyncTimer->Reset();
1995 
1996  fbBlockSync = kFALSE;
1997 }
1998 
2000 {
2001  if (topslot==0) return 0;
2002  Int_t sizeinfo = ItemSizeInfo(topslot);
2003  bool verytop = fxBrowserSlot==topslot;
2004  if (!verytop && ItemKind(topslot)!=TGo4Access::kndFolder) return sizeinfo;
2005 
2006  Int_t sum = 0;
2007  for (Int_t n=0;n<topslot->NumChilds();n++)
2008  sum += CalculateFolderSizes(topslot->GetChild(n));
2009  if (!verytop) SetCalcSize(topslot, sum);
2010 
2011  return sum;
2012 }
2013 
2014 Int_t TGo4BrowserProxy::DefineItemProperties(Int_t kind, TClass* cl, TString& pixmap)
2015 {
2016  // 100000000 - execute,
2017  // 10000000 - expand,
2018  // 1000000 - export,
2019  // 100000 - info,
2020  // 10000 - close,
2021  // 1000 - clear,
2022  // 100 - draw,
2023  // 10 - drag,
2024  // 1 - edit
2025 
2026  Int_t cando = 0;
2027 
2028  // TClass * cl = TGo4Proxy::GetClass(clname);
2029 
2030  if (kind==TGo4Access::kndObject) {
2031  if (cl!=0) {
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"; }
2057  }
2058  } else
2059  if ((kind==TGo4Access::kndFolder) || (kind==TGo4Access::kndMoreFolder)) {
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"; }
2069  if (kind==TGo4Access::kndMoreFolder) cando += 10000000;
2070  } else
2071  if (kind==TGo4Access::kndTreeBranch)
2072  pixmap = "branch_t.png";
2073  else
2074  if (kind==TGo4Access::kndTreeLeaf) {
2075  cando = 11; pixmap = "leaf_t.png";
2076  } else
2077  if (kind==TGo4Access::kndGo4Param) {
2078  cando = 1011; pixmap = "parameter.png";
2079  } else
2080  if (kind==TGo4Access::kndDataMember) {
2081  cando = 10; pixmap = "eventitem.png";
2082  } else
2083  if (kind==TGo4Access::kndEventElement) {
2084  cando = 100010; pixmap = "eventobj.png";
2085  } else
2086  if (kind==TGo4Access::kndRootCommand) {
2087  cando = 100000000; pixmap = "eventobj.png";
2088  }
2089 
2090  return cando;
2091 }
2092 
2093 Bool_t TGo4BrowserProxy::CompareAxisValues(Double_t v1, Double_t v2, Double_t scale)
2094 {
2095  if (v1==v2) return kTRUE;
2096 
2097  return (fabs(v1-v2) <= scale);
2098 }
2099 
2100 Int_t TGo4BrowserProxy::CompareAxis(TAxis* ax1, TAxis* ax2)
2101 {
2102  // return rebin factor
2103  // 0 - axis are different
2104  // 1 - both axis the same
2105  // >1 - rebin factor than ax2->Rebin(n) will produce ax1
2106 
2107  if ((ax1==0) || (ax2==0)) return 0;
2108 
2109  Int_t num1 = ax1->GetNbins();
2110  Int_t num2 = ax2->GetNbins();
2111 
2112  Double_t scale = fabs(ax1->GetXmax() - ax1->GetXmin()) / (num1+1.) * 1e-3;
2113 
2114  if ((num1!=num2)) {
2115  // Minimum number for rebin is 2, therefore num2 should not more than num1/2
2116  if ((num1>num2/2) || (num1<2)) return 0;
2117 
2118  Int_t rebin = num2/num1;
2119  if (rebin==0) return 0;
2120 
2121  // support only uniform scale rebinning
2122  if ((ax1->GetXbins()->GetSize()!=0) || (ax1->GetXbins()->GetSize()!=0)) return 0;
2123 
2124  // minimum value on both axis should be the same
2125  if (!CompareAxisValues(ax1->GetXmin(), ax2->GetXmin(), scale)) return 0;
2126 
2127  Double_t xmax;
2128 
2129  if (num1*rebin!=num2) xmax = ax2->GetBinUpEdge(num1*rebin);
2130  else xmax = ax2->GetXmax();
2131 
2132  // maximum value on both axis should be the same
2133  if (!CompareAxisValues(ax1->GetXmax(), xmax, scale)) return 0;
2134 
2135  return rebin;
2136  }
2137 
2138  if ((ax1->GetXbins()->GetSize()==0) && (ax1->GetXbins()->GetSize()==0)) {
2139  if (!CompareAxisValues(ax1->GetXmin(), ax2->GetXmin(), scale)) return 0;
2140  if (!CompareAxisValues(ax1->GetXmax(), ax2->GetXmax(), scale)) return 0;
2141  } else
2142  for (Int_t n=1;n<=num1;n++)
2143  if (!CompareAxisValues(ax1->GetBinCenter(n),
2144  ax2->GetBinCenter(n), scale)) return 0;
2145 
2146  return 1;
2147 }
2148 
2149 
2150 Bool_t TGo4BrowserProxy::UpdateObjectContent(TObject* obj, TObject* newobj, Int_t* hasrebinx, Int_t* hasrebiny)
2151 {
2152  Bool_t tdisp(kFALSE);
2153  TString tform;
2154 
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;
2159 
2160  if (dynamic_cast<TProfile*>(obj)!=0) return kFALSE;
2161 
2162  if (histo->GetDimension()!=histo2->GetDimension()) return kFALSE;
2163 
2164  histo->SetTitle(histo2->GetTitle());
2165 
2166  Int_t rebinx = 1, rebiny = 1;
2167 
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;
2173 
2174  if ((rebinx==0) || (rebiny==0)) return kFALSE;
2175 
2176  // in case when object was interactively rebin,
2177  // try to repeat same operation with new object to perform content update
2178  if ((rebinx>1) || (rebiny>1)) {
2179  if ((hasrebinx==0) || (hasrebiny==0)) return kFALSE;
2180 
2181  TH1* clon = (TH1*) histo2->Clone("____dummyhisto____");
2182  if (clon==0) return kFALSE;
2183  clon->SetDirectory(0);
2184  Bool_t rebinres = kFALSE;
2185 
2186  if (histo->GetDimension()==1) {
2187  clon->Rebin(rebinx);
2188  rebinres = UpdateObjectContent(histo, clon);
2189  }
2190 #if ROOT_VERSION_CODE > ROOT_VERSION(4,3,2)
2191  else
2192  if (histo->GetDimension()==2) {
2193  TH2* h2 = dynamic_cast<TH2*>(clon);
2194  if (h2!=0) h2->Rebin2D(rebinx, rebiny);
2195  rebinres = UpdateObjectContent(histo, h2);
2196  }
2197 #endif
2198  delete clon;
2199 
2200  if (rebinres) {
2201  *hasrebinx = rebinx;
2202  *hasrebiny = rebiny;
2203  }
2204 
2205  return rebinres;
2206  }
2207 
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);
2216 #else
2217  Bool_t canrebin = histo->CanExtendAllAxes();
2218  histo->SetCanExtend(TH1::kNoAxis);
2219 #endif
2220  Double_t sum = 0;
2221  for (int n=0;n<sz;n++) {
2222  Stat_t value = histo2->GetBinContent(n);
2223  sum += value;
2224  histo->SetBinContent(n, value);
2225  }
2226 
2227 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
2228  if (canrebin) histo->SetBit(TH1::kCanRebin, kTRUE);
2229 #else
2230  if (canrebin) histo->SetCanExtend(TH1::kAllAxes);
2231 #endif
2232 
2233  histo->SetEntries(sum);
2234 
2235 #if ROOT_VERSION_CODE > ROOT_VERSION(4,3,2)
2236  TArrayD *sumw_tgt = 0, *sumw_src = 0;
2237 
2238  if (histo2->GetSumw2N()>0)
2239  sumw_src = histo2->GetSumw2();
2240  // printf ("JAM*** TGo4BrowserProxy::UpdateObjectContent histo2 %s has sumw2 n:%d, sum_src 0x%lx \n",histo2->GetName(), histo2->GetSumw2N(), (long) sumw_src);
2241 
2242 
2243  // if source has no sumw, target should also not has them
2244  if (sumw_src==0) {
2245  histo->GetSumw2()->Set(0);
2246  } else {
2247 // printf ("JAM*** TGo4BrowserProxy::UpdateObjectContent calling Sumw2 for histo1 %s , sumw2 before was N:%d, ptr: 0x%lx\n",
2248 // histo->GetName(), histo->GetSumw2N(), (long) histo->GetSumw2());
2249 
2250  if(histo->GetSumw2N()==0) // JAM2018 workaround to reduce warnings in ROOT 6 (?)
2251  histo->Sumw2();
2252  sumw_tgt = histo->GetSumw2();
2253  }
2254 
2255  if (sumw_src && sumw_tgt)
2256  sumw_tgt->Set(sz, sumw_src->GetArray());
2257 #endif
2258 
2259  return kTRUE;
2260  } else
2261  if (obj->InheritsFrom(TGo4Condition::Class())) {
2262  TGo4Condition* cond = dynamic_cast<TGo4Condition*> (obj);
2263  TGo4Condition* newcond = dynamic_cast<TGo4Condition*> (newobj);
2264  if ((cond==0) || (newcond==0)) return kFALSE;
2265 
2266  cond->UpdateFrom(newcond, kTRUE);
2267  cond->SetChanged(kFALSE);
2268 
2269  return kTRUE;
2270  } else
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;
2275  SaveAxisTimeProperties(gr,tdisp,tform);
2276  gr->SetTitle(newgr->GetTitle());
2277 
2278  Int_t npoints = newgr->GetN();
2279  gr->Set(npoints);
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);
2290 #endif
2291  }
2292 
2293  UpdateListOfFunctions(gr,newgr);
2294  RestoreAxisTimeProperties(gr,tdisp,tform);
2295  return kTRUE;
2296  } else
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;
2301  SaveAxisTimeProperties(gr,tdisp,tform);
2302  gr->SetTitle(newgr->GetTitle());
2303 
2304  Int_t npoints = newgr->GetN();
2305  gr->Set(npoints);
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);
2313  }
2314 
2315  UpdateListOfFunctions(gr,newgr);
2316  RestoreAxisTimeProperties(gr,tdisp,tform);
2317 
2318  return kTRUE;
2319  } else
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;
2324  // JAM: save axis time properties of currently displayed histo
2325  SaveAxisTimeProperties(gr,tdisp,tform);
2326 
2327 
2328  gr->SetTitle(newgr->GetTitle());
2329 
2330  Int_t npoints = newgr->GetN();
2331  gr->Set(npoints);
2332  Double_t xp, yp;
2333  for (Int_t n=0;n<npoints;n++) {
2334  newgr->GetPoint(n,xp,yp);
2335  gr->SetPoint(n,xp,yp);
2336  }
2337  UpdateListOfFunctions(gr,newgr);
2338  RestoreAxisTimeProperties(gr,tdisp,tform);
2339 
2340  return kTRUE;
2341  } else
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;
2346 
2347  l0->SetTitle(l1->GetTitle());
2348 
2349  return kTRUE;
2350  }
2351  // JAM test
2352  if (obj->InheritsFrom(TF1::Class())) {
2353  //std::cout <<"Update object contents with TF1"<<obj->GetName() << std::endl;
2354  TF1* f0 = dynamic_cast<TF1*> (obj);
2355  TF1* f1 = dynamic_cast<TF1*> (newobj);
2356  if ((f1==0) || (f0==0)) return kFALSE;
2357  f1->Copy(*f0);
2358  return kTRUE;
2359  }
2360 
2361 
2362  return kFALSE;
2363 }
2364 
2365 
2366 void TGo4BrowserProxy::SaveAxisTimeProperties(TGraph* gr, Bool_t& timedisplay, TString& format)
2367 {
2368  if(gr==0) return;
2369  TH1* h1=gr->GetHistogram();
2370  TAxis* xax=h1->GetXaxis();
2371  timedisplay=xax->GetTimeDisplay();
2372  format=xax->GetTimeFormat();
2373 }
2374 
2375 void TGo4BrowserProxy::RestoreAxisTimeProperties(TGraph* gr, Bool_t& timedisplay, TString& format)
2376 {
2377  if(gr==0) return;
2378  TH1*h1=gr->GetHistogram();
2379  TAxis* xax=h1->GetXaxis();
2380  xax->SetTimeDisplay(timedisplay);
2381  xax->SetTimeFormat(format.Data());
2382 }
2383 
2384 
2385 void TGo4BrowserProxy::UpdateListOfFunctions(TGraph* oldgr, TGraph* newgr)
2386 {
2387  if(oldgr==0 || newgr==0) return;
2388  TList* theFunctions=oldgr->GetListOfFunctions();
2389  TObject *obj;
2390  while ((obj = theFunctions->First())) {
2391  while (theFunctions->Remove(obj)) { }
2392  //std::cout <<"Removed function object "<<obj->GetName() << std::endl;
2393  delete obj;
2394  }
2395 
2396  TList* newFunctions=newgr->GetListOfFunctions();
2397  TListIter fiter(newFunctions);
2398  TF1* fun=0;
2399  while((fun=dynamic_cast<TF1*>(fiter.Next())) !=0)
2400  {
2401  TF1* fclon=dynamic_cast<TF1*>(fun->Clone());
2402  theFunctions->Add(fclon);
2403  fclon->SetParent(oldgr);
2404  //std::cout <<"Added function object "<<fclon->GetName() << std::endl;
2405  }
2406 
2407 
2408  // also restore graph axis titles here:
2409  TH1* oldhis=oldgr->GetHistogram();
2410  TH1* newhis=newgr->GetHistogram();
2411  if(oldhis && newhis)
2412  {
2413  oldhis->GetXaxis()->SetTitle(newhis->GetXaxis()->GetTitle());
2414  oldhis->GetYaxis()->SetTitle(newhis->GetYaxis()->GetTitle());
2415  }
2416 
2417 }
2418 
2419 
2420 
2421 void TGo4BrowserProxy::AddWaitingList(TGo4Slot* itemslot, const char* destination)
2422 {
2423  if (itemslot==0) return;
2424  if (fxWaitingList==0) fxWaitingList = new TList;
2425 
2426  TString itemname;
2427  if (!BrowserItemName(itemslot, itemname)) return;
2428 
2429  TNamed* n = (TNamed*) fxWaitingList->FindObject(itemname.Data());
2430  if (n!=0)
2431  n->SetTitle(destination);
2432  else
2433  fxWaitingList->Add(new TNamed(itemname.Data(), destination));
2434 }
2435 
2437 {
2438  if (fxWaitingList==0) return;
2439 
2440  TString itemname;
2441  if (!BrowserItemName(source, itemname)) return;
2442 
2443  TNamed* n = (TNamed*) fxWaitingList->FindObject(itemname.Data());
2444  if (n!=0) {
2445  const char* dest = n->GetTitle();
2446  if ((dest!=0) && (strlen(dest)==0)) dest = 0;
2447  ProduceExplicitCopy(source, dest, kFALSE);
2448  fxWaitingList->Remove(n);
2449  delete n;
2450  }
2451 }
2452 
2453 // used by ROOT browser
2454 
2456 {
2457  TIter next(gROOT->GetListOfCanvases());
2458  TPad* pad = 0;
2459  while ((pad = (TPad*) next()) != 0) {
2460  pad->Modified();
2461 
2462  TVirtualPad* subpad = 0;
2463  Int_t number = 0;
2464  while ((subpad = pad->GetPad(number++))!=0)
2465  subpad->Modified();
2466 
2467  pad->Update();
2468  }
2469 }
static bool CanClearItem(int cando)
virtual void Reset()
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)
Definition: TGo4Slot.cxx:646
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)
Definition: TGo4Proxy.cxx:75
Int_t GetDivX()
Definition: TGo4Picture.h:57
virtual Bool_t IsConnected()
Bool_t IsItemMonitored(TGo4Slot *slot)
Int_t GetNumObjNames()
void MakeHttpList(TObjArray *arr)
TString FindItem(const char *objname)
void SetIntPar(const char *name, Int_t value)
Definition: TGo4Slot.cxx:639
virtual void Update(TGo4Slot *slot, Bool_t strong)
const char * getinfo()
Definition: TGo4Iter.cxx:121
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)
Definition: TGo4Slot.cxx:313
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)
Bool_t IsDivided()
Definition: TGo4Picture.h:59
TGo4Slot * FindSlot(const char *fullpath, const char **subname=0)
Definition: TGo4Slot.cxx:489
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()
Definition: TGo4Proxy.h:109
virtual void Initialize(TGo4Slot *slot)
Bool_t DefineLeafName(const char *itemname, const char *treename, TString &leafname)
void AddFile(const char *pathname, const char *filename)
Bool_t isfolder()
Definition: TGo4Iter.cxx:109
void UnregisterLink(TGo4Slot *target)
Bool_t IsItemRemote(const char *name)
void SetCurrentDir(const char *dir=0)
static bool CanDrawItem(int cando)
TGo4Proxy * GetProxy() const
Definition: TGo4Slot.h:93
const char * GetObjName(Int_t n)
Bool_t IsFile() const
Int_t UpdateVisibleAnalysisObjects(bool checkmonitor)
void RenameMemoryItem(const char *itemname, const char *newname)
virtual void ProduceFullName(TString &name, TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:280
void MakeFolder(const char *pathname)
void SetProtectionBits(TGo4Slot *slot, Int_t delprot, Int_t clearprot)
Int_t ItemCanDo(const char *name)
virtual Bool_t IsGo4Analysis() const
TGo4Slot * getslot() const
Definition: TGo4Iter.cxx:167
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
Definition: TGo4Slot.cxx:621
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)
Definition: TGo4Slot.cxx:221
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)
TGo4Slot * fxBrowserSlot
TGo4ObjectManager * fxOM
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()
Definition: TGo4Iter.cxx:145
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)
Definition: TGo4Iter.cxx:133
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)
Definition: TGo4Slot.cxx:525
static const char * ItemInfo(TGo4Slot *slot)
static bool CanDragItem(int cando)
TObject * GetAssignedObject()
Definition: TGo4Slot.cxx:373
Bool_t IsCanDelete(TGo4Slot *slot)
Int_t CalculateFolderSizes(TGo4Slot *topslot)
void CopyClipboard(const char *tgtpath, Bool_t forcerequest=kFALSE)
const char * getfullname()
Definition: TGo4Iter.cxx:152
static bool CanExportItem(int cando)
Bool_t IsParent(const TGo4Slot *slot) const
Definition: TGo4Slot.cxx:197
virtual Bool_t RefreshNamesList()
TObject * GetObject(const char *name=0)
TGo4Slot * FindChild(const char *name)
Definition: TGo4Slot.cxx:262
Bool_t DefineFileObject(const char *itemname, TString &filedataslot, const char **filepath)
void CreateMemoryFolder(const char *foldername=0)
Int_t getkindofitem()
Definition: TGo4Iter.cxx:139
void ClearMemoryItem(const char *itemname)
virtual void RemoteTreeDraw(const char *treename, const char *varexp, const char *cutcond, const char *hname)
TGo4Slot * GetParent() const
Definition: TGo4Slot.h:58
Int_t ItemSizeInfo(TGo4Slot *slot)
void MakeFilesList(TObjArray *arr)
virtual void Update(Bool_t strong=kFALSE)
Definition: TGo4Slot.cxx:379
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)
Definition: TGo4Slot.cxx:471
void SaveDataToFile(TFile *f, Bool_t onlyobjs=kFALSE, TGo4Slot *startslot=0)
Bool_t UpdateObjectInFile(const char *filepath, TObject *obj)
void RequestObjectStatus(const char *name, TGo4Slot *tgtslot)
void RemovePar(const char *name)
Definition: TGo4Slot.cxx:628
TString FindItemInAnalysis(const char *objname)
const char * ItemClassName(const char *name)
void Reset()
Definition: TGo4Picture.h:234
TVirtualTreePlayer * fDummyTreePlayer
static const char * Message(Int_t prio, const char *text,...)
Definition: TGo4Log.cxx:209
void AddToClipboard(const char *itemname)
const char * getname()
Definition: TGo4Iter.cxx:115
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)
Int_t GetDivY()
Definition: TGo4Picture.h:58
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)
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)
Definition: TGo4Slot.cxx:668
TGo4Slot * GetLink() const
Definition: TGo4LinkProxy.h:45
void ForwardEvent(TGo4Slot *source, Int_t id, void *param=0)
Definition: TGo4Slot.cxx:585
Int_t levelchange() const
Definition: TGo4Iter.h:42
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)
Go4Export_t
Bool_t AssignObject(TObject *obj, Bool_t owner)
Definition: TGo4Slot.cxx:361
Int_t NumChilds() const
Definition: TGo4Slot.h:76
static bool CanInfoItem(int cando)
TGo4BrowserObjProxy(TGo4Slot *slot, TObject *obj, Bool_t owner)
TString GetFullName(TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:290
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
Definition: TGo4Slot.cxx:298
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)
Definition: TGo4Slot.cxx:609
TGo4Slot * GetChild(Int_t n) const
Definition: TGo4Slot.h:77
TObjArray * fxClipboard
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)
TGo4Slot * GetNext()
Definition: TGo4Slot.cxx:274
Bool_t next(Bool_t goesinto=kTRUE)
Definition: TGo4Iter.cxx:45
virtual Bool_t Use() const
Int_t getsizeinfo()
Definition: TGo4Iter.cxx:127
void BrowserSlotName(const char *item, TString &res)