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