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