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