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