Logo ROOT  
Reference Guide
TEveManager.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TEveManager.h"
13
14#include "TEveSelection.h"
15#include "TEveViewer.h"
16#include "TEveScene.h"
17#include "TEveEventManager.h"
18#include "TEveWindowManager.h"
19
20#include "TEveBrowser.h"
21#include "TEveGedEditor.h"
22
23#include "TGStatusBar.h"
24
25#include "TGLSAViewer.h"
26
27#include "TGeoManager.h"
28#include "TGeoMatrix.h"
29#include "TObjString.h"
30#include "TROOT.h"
31#include "TFile.h"
32#include "TMap.h"
33#include "TExMap.h"
34#include "TMacro.h"
35#include "TFolder.h"
36#include "TCanvas.h"
37#include "TSystem.h"
38#include "TApplication.h"
39#include "TColor.h"
40#include "TPluginManager.h"
41#include "TPRegexp.h"
42#include "TClass.h"
43
44#include <iostream>
45#include <fstream>
46
47TEveManager *gEve = nullptr;
48
49/** \class TEveManager
50\ingroup TEve
51Central application manager for Eve.
52Manages elements, GUI, GL scenes and GL viewers.
53*/
54
56
57////////////////////////////////////////////////////////////////////////////////
58
60 fExcHandler (0),
61 fVizDB (0), fVizDBReplace(kTRUE), fVizDBUpdate(kTRUE),
62 fGeometries (0),
63 fGeometryAliases (0),
64 fBrowser (0),
65
66 fMacroFolder (0),
67
68 fWindowManager (0),
69 fViewers (0),
70 fScenes (0),
71 fGlobalScene (0),
72 fEventScene (0),
73 fCurrentEvent (0),
74
75 fRedrawDisabled (0),
76 fResetCameras (kFALSE),
77 fDropLogicals (kFALSE),
78 fKeepEmptyCont (kFALSE),
79 fTimerActive (kFALSE),
80 fRedrawTimer (),
81
82 fStampedElements(0),
83 fSelection (0),
84 fHighlight (0),
85
86 fOrphanage (0),
87 fUseOrphanage (kFALSE)
88{
89 // Constructor.
90 // If map_window is true, the TEveBrowser window is mapped.
91 //
92 // Option string is first parsed for the following characters:
93 // V - spawn a default GL viewer.
94 //
95 // The consumed characters are removed from the options and they
96 // are passed to TEveBrowser for creation of additional plugins.
97 //
98 // Default options: "FIV" - file-browser, command-line, GL-viewer.
99
100
101 static const TEveException eh("TEveManager::TEveManager ");
102
103 if (gEve != 0)
104 throw(eh + "There can be only one!");
105
106 gEve = this;
107
109
113
115
116 fSelection = new TEveSelection("Global Selection");
118 fHighlight = new TEveSelection("Global Highlight");
121
122 fOrphanage = new TEveElementList("Global Orphanage");
124
125 fRedrawTimer.Connect("Timeout()", "TEveManager", this, "DoRedraw3D()");
126 fMacroFolder = new TFolder("EVE", "Visualization macros");
127 gROOT->GetListOfBrowsables()->Add(fMacroFolder);
128
129
130 fWindowManager = new TEveWindowManager("WindowManager", "Manager of EVE windows");
131
132 // Build GUI
133 fBrowser = new TEveBrowser(w, h);
134
135 // ListTreeEditor
138 fBrowser->StopEmbedding("Eve");
140
141 // See how many GL viewers are requested, remove from options.
142 TString str_opt(opt);
143 TPMERegexp viewer_re("V", "g");
144 Int_t viewer_count = viewer_re.Substitute(str_opt, "", kFALSE);
145
146 // Create the main window / browse.
147 fBrowser->InitPlugins(str_opt);
148 if (map_window)
150
151 // --------------------------------
152
155
156 fViewers = new TEveViewerList("Viewers");
159
160 fScenes = new TEveSceneList ("Scenes");
163
164 fGlobalScene = new TEveScene("Geometry scene");
167
168 fEventScene = new TEveScene("Event scene");
171
172 for (Int_t vc = 0; vc < viewer_count; ++vc)
173 {
174 TEveViewer* v = SpawnNewViewer(Form("Viewer %d", vc+1));
175 v->AddScene(fGlobalScene);
176 v->AddScene(fEventScene);
177 }
178
179 if (GetDefaultViewer())
180 {
182 }
183
185}
186
187////////////////////////////////////////////////////////////////////////////////
188/// Destructor.
189
191{
192 // Stop timer and deny further redraw requests.
195
196 delete fCurrentEvent;
197 fCurrentEvent = 0;
198
203 fScenes->Destroy();
204 fScenes = 0;
205
208 fViewers->Destroy();
209 fViewers = 0;
210
214 fWindowManager = 0;
215
219
220 gROOT->GetListOfBrowsables()->Remove(fMacroFolder);
221 delete fMacroFolder;
222
223 delete fGeometryAliases;
224 delete fGeometries;
225 delete fVizDB;
226 delete fExcHandler;
227 delete fStampedElements;
228
230
232 fBrowser->TRootBrowser::CloseWindow();
233}
234
235////////////////////////////////////////////////////////////////////////////////
236/// Clear the orphanage.
237
239{
240 Bool_t old_state = fUseOrphanage;
243 fUseOrphanage = old_state;
244}
245
246////////////////////////////////////////////////////////////////////////////////
247/// Get the main window, i.e. EVE-browser.
248
250{
251 return fBrowser;
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// Returns the default viewer - the first one in the fViewers list.
256
258{
259 return dynamic_cast<TEveViewer*>(fViewers->FirstChild());
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Get TGLViewer of the default TEveViewer.
264
266{
268 return ev ? ev->GetGLViewer() : 0;
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Returns main object editor.
273
275{
276 return fLTEFrame->GetEditor();
277}
278
279////////////////////////////////////////////////////////////////////////////////
280/// Returns main window status bar.
281
283{
284 return fBrowser->GetStatusBar();
285}
286
287////////////////////////////////////////////////////////////////////////////////
288/// Add a new canvas tab.
289
291{
292 fBrowser->StartEmbedding(1, -1);
293 TCanvas* c = new TCanvas;
295
296 return c;
297}
298
299////////////////////////////////////////////////////////////////////////////////
300/// Create a new GL viewer.
301
302TEveViewer* TEveManager::SpawnNewViewer(const char* name, const char* title,
303 Bool_t embed)
304{
305 TEveWindowSlot* slot = 0;
306 if (embed)
307 {
309 if (slot == 0)
310 {
311 // In principle should have some default/current container
312 // in TEveWindowManager.
313 // Also to store closed windows.
316 }
317 }
318 else
319 {
321 }
322
323 TEveViewer* v = new TEveViewer(name, title);
324 v->SpawnGLViewer(embed ? GetEditor() : 0);
325
326 slot->ReplaceWindow(v);
327
329
330 return v;
331}
332
333////////////////////////////////////////////////////////////////////////////////
334/// Create a new scene.
335
336TEveScene* TEveManager::SpawnNewScene(const char* name, const char* title)
337{
338 TEveScene* s = new TEveScene(name, title);
340 return s;
341}
342
343////////////////////////////////////////////////////////////////////////////////
344/// Find macro in fMacroFolder by name.
345
347{
348 return dynamic_cast<TMacro*>(fMacroFolder->FindObject(name));
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// Show element in default editor.
353
355{
356 static const TEveException eh("TEveManager::EditElement ");
357
358 GetEditor()->DisplayElement(element);
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Register a request for 3D redraw.
363
365{
368}
369
370////////////////////////////////////////////////////////////////////////////////
371/// Perform 3D redraw of scenes and viewers whose contents has
372/// changed.
373
375{
376 static const TEveException eh("TEveManager::DoRedraw3D ");
377
378 // printf("TEveManager::DoRedraw3D redraw triggered\n");
379
380 // Process element visibility changes, mark relevant scenes as changed.
381 {
382 TEveElement::List_t scenes;
383 Long64_t key, value;
384 TExMapIter stamped_elements(fStampedElements);
385 while (stamped_elements.Next(key, value))
386 {
387 TEveElement *el = reinterpret_cast<TEveElement*>(key);
389 {
390 el->CollectSceneParents(scenes);
391 }
392 }
393 ScenesChanged(scenes);
394 }
395
396 // Process changes in scenes.
399
400 // Process changed elements again, update GUI (just editor so far,
401 // but more can come).
402 {
403 Long64_t key, value;
404 TExMapIter stamped_elements(fStampedElements);
405 while (stamped_elements.Next(key, value))
406 {
407 TEveElement *el = reinterpret_cast<TEveElement*>(key);
408 if (GetEditor()->GetModel() == el->GetEditorObject(eh))
409 EditElement(el);
411
412 el->ClearStamps();
413 }
414 }
416 GetListTree()->ClearViewPort(); // Fix this when several list-trees can be added.
417
420
422}
423
424////////////////////////////////////////////////////////////////////////////////
425/// Perform 3D redraw of all scenes and viewers.
426
427void TEveManager::FullRedraw3D(Bool_t resetCameras, Bool_t dropLogicals)
428{
429 fScenes ->RepaintAllScenes (dropLogicals);
430 fViewers->RepaintAllViewers(resetCameras, dropLogicals);
431}
432
433////////////////////////////////////////////////////////////////////////////////
434/// Element was changed, perform framework side action.
435/// Called from TEveElement::ElementChanged().
436
437void TEveManager::ElementChanged(TEveElement* element, Bool_t update_scenes, Bool_t redraw)
438{
439 static const TEveException eh("TEveElement::ElementChanged ");
440
441 if (GetEditor()->GetModel() == element->GetEditorObject(eh))
442 EditElement(element);
444
445 if (update_scenes) {
446 TEveElement::List_t scenes;
447 element->CollectSceneParents(scenes);
448 ScenesChanged(scenes);
449 }
450
451 if (redraw)
452 Redraw3D();
453}
454
455////////////////////////////////////////////////////////////////////////////////
456/// Mark all scenes from the given list as changed.
457
459{
460 for (TEveElement::List_i s=scenes.begin(); s!=scenes.end(); ++s)
461 ((TEveScene*)*s)->Changed();
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Mark element as changed -- it will be processed on next redraw.
466
468{
469 UInt_t slot;
470 if (fStampedElements->GetValue((ULong64_t) element, (Long64_t) element, slot) == 0)
471 {
472 fStampedElements->AddAt(slot, (ULong64_t) element, (Long64_t) element, 1);
473 }
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Get default list-tree widget.
478
480{
481 return fLTEFrame->fListTree;
482}
483
486{
487 // Add element as a top-level to a list-tree.
488 // Only add a single copy of a render-element as a top level.
489
490 if (lt == 0) lt = GetListTree();
492 if (open) lt->OpenItem(lti);
493 return lti;
494}
495
496////////////////////////////////////////////////////////////////////////////////
497/// Remove top-level element from list-tree with specified tree-item.
498
500 TGListTree* lt, TGListTreeItem* lti)
501{
502 static const TEveException eh("TEveManager::RemoveFromListTree ");
503
504 if (lti->GetParent())
505 throw(eh + "not a top-level item.");
506
507 element->RemoveFromListTree(lt, 0);
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Add a new event and make it the current event.
512/// It is added into the event-scene and as a top-level list-tree
513/// item.
514
516{
520 return AddToListTree(event, kTRUE);
521}
522
523////////////////////////////////////////////////////////////////////////////////
524/// Add an element. If parent is not specified it is added into
525/// current event (which is created if does not exist).
526
528{
529 if (parent == 0) {
530 if (fCurrentEvent == 0)
531 AddEvent(new TEveEventManager("Event", "Auto-created event directory"));
532 parent = fCurrentEvent;
533 }
534
535 parent->AddElement(element);
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// Add a global element, i.e. one that does not change on each
540/// event, like geometry or projection manager.
541/// If parent is not specified it is added to a global scene.
542
544{
545 if (parent == 0)
546 parent = fGlobalScene;
547
548 parent->AddElement(element);
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// Remove element from parent.
553
555 TEveElement* parent)
556{
557 parent->RemoveElement(element);
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Called from TEveElement prior to its destruction so the
562/// framework components (like object editor) can unreference it.
563
565{
566 if (GetEditor()->GetEveElement() == element)
567 EditElement(0);
569
570 if (fScenes)
572
573 if (fStampedElements->GetValue((ULong64_t) element, (Long64_t) element) != 0)
574 fStampedElements->Remove((ULong64_t) element, (Long64_t) element);
575
576 if (element->fImpliedSelected > 0)
578 if (element->fImpliedHighlighted > 0)
580}
581
582////////////////////////////////////////////////////////////////////////////////
583/// Select an element.
584/// Now it only calls EditElement() - should also update selection state.
585
587{
588 if (element != 0)
589 EditElement(element);
590}
591
592////////////////////////////////////////////////////////////////////////////////
593/// Paste has been called.
594
596{
597 // The object to paste is taken from the editor (this is not
598 // exactly right) and handed to 'element' for pasting.
599
601 if (src)
602 return element->HandleElementPaste(src);
603 return kFALSE;
604}
605
606////////////////////////////////////////////////////////////////////////////////
607/// Insert a new visualization-parameter database entry. Returns
608/// true if the element is inserted successfully.
609/// If entry with the same key already exists the behaviour depends on the
610/// 'replace' flag:
611/// - true - The old model is deleted and new one is inserted (default).
612/// Clients of the old model are transferred to the new one and
613/// if 'update' flag is true (default), the new model's parameters
614/// are assigned to all clients.
615/// - false - The old model is kept, false is returned.
616///
617/// If insert is successful, the ownership of the model-element is
618/// transferred to the manager.
619
621 Bool_t replace, Bool_t update)
622{
623 TPair* pair = (TPair*) fVizDB->FindObject(tag);
624 if (pair)
625 {
626 if (replace)
627 {
628 model->IncDenyDestroy();
629 model->SetRnrChildren(kFALSE);
630
631 TEveElement* old_model = dynamic_cast<TEveElement*>(pair->Value());
632 if (old_model)
633 {
634 while (old_model->HasChildren())
635 {
636 TEveElement *el = old_model->FirstChild();
637 el->SetVizModel(model);
638 if (update)
639 {
640 el->CopyVizParams(model);
642 }
643 }
644 old_model->DecDenyDestroy();
645 }
646 pair->SetValue(dynamic_cast<TObject*>(model));
647 return kTRUE;
648 }
649 else
650 {
651 return kFALSE;
652 }
653 }
654 else
655 {
656 model->IncDenyDestroy();
657 model->SetRnrChildren(kFALSE);
658 fVizDB->Add(new TObjString(tag), dynamic_cast<TObject*>(model));
659 return kTRUE;
660 }
661}
662
663////////////////////////////////////////////////////////////////////////////////
664/// Insert a new visualization-parameter database entry with the default
665/// parameters for replace and update, as specified by members
666/// fVizDBReplace(default=kTRUE) and fVizDBUpdate(default=kTRUE).
667/// See docs of the above function.
668
670{
671 return InsertVizDBEntry(tag, model, fVizDBReplace, fVizDBUpdate);
672}
673
674////////////////////////////////////////////////////////////////////////////////
675/// Find a visualization-parameter database entry corresponding to tag.
676/// If the entry is not found 0 is returned.
677
679{
680 return dynamic_cast<TEveElement*>(fVizDB->GetValue(tag));
681}
682
683////////////////////////////////////////////////////////////////////////////////
684/// Load visualization-parameter database from file filename. The
685/// replace, update arguments replace the values of fVizDBReplace
686/// and fVizDBUpdate members for the duration of the macro
687/// execution.
688
689void TEveManager::LoadVizDB(const TString& filename, Bool_t replace, Bool_t update)
690{
691 Bool_t ex_replace = fVizDBReplace;
692 Bool_t ex_update = fVizDBUpdate;
693 fVizDBReplace = replace;
695
696 LoadVizDB(filename);
697
698 fVizDBReplace = ex_replace;
699 fVizDBUpdate = ex_update;
700}
701
702////////////////////////////////////////////////////////////////////////////////
703/// Load visualization-parameter database from file filename.
704/// State of data-members fVizDBReplace and fVizDBUpdate determine
705/// how the registered entries are handled.
706
707void TEveManager::LoadVizDB(const TString& filename)
708{
709 TEveUtil::Macro(filename);
710 Redraw3D();
711}
712
713////////////////////////////////////////////////////////////////////////////////
714/// Save visualization-parameter database to file filename.
715
716void TEveManager::SaveVizDB(const TString& filename)
717{
718 TPMERegexp re("(.+)\\.\\w+");
719 if (re.Match(filename) != 2) {
720 Error("SaveVizDB", "filename does not match required format '(.+)\\.\\w+'.");
721 return;
722 }
723
724 TString exp_filename(filename);
725 gSystem->ExpandPathName(exp_filename);
726
727 std::ofstream out(exp_filename, std::ios::out | std::ios::trunc);
728 out << "void " << re[1] << "()\n";
729 out << "{\n";
730 out << " TEveManager::Create();\n";
731
733
734 Int_t var_id = 0;
735 TString var_name;
736 TIter next(fVizDB);
737 TObjString *key;
738 while ((key = (TObjString*)next()))
739 {
740 TEveElement* mdl = dynamic_cast<TEveElement*>(fVizDB->GetValue(key));
741 if (mdl)
742 {
743 var_name.Form("x%03d", var_id++);
744 mdl->SaveVizParams(out, key->String(), var_name);
745 }
746 else
747 {
748 Warning("SaveVizDB", "Saving failed for key '%s'.", key->String().Data());
749 }
750 }
751
752 out << "}\n";
753 out.close();
754}
755
756////////////////////////////////////////////////////////////////////////////////
757/// Get geometry with given filename.
758/// This is cached internally so the second time this function is
759/// called with the same argument the same geo-manager is returned.
760/// gGeoManager is set to the return value.
761
763{
764 static const TEveException eh("TEveManager::GetGeometry ");
765
766 TString exp_filename = filename;
767 gSystem->ExpandPathName(exp_filename);
768 printf("%s loading: '%s' -> '%s'.\n", eh.Data(),
769 filename.Data(), exp_filename.Data());
770
772 if (gGeoManager)
773 {
775 }
776 else
777 {
778 Bool_t locked = TGeoManager::IsLocked();
779 if (locked) {
780 Warning(eh, "TGeoManager is locked ... unlocking it.");
782 }
783 if (TGeoManager::Import(filename) == 0) {
784 throw(eh + "TGeoManager::Import() failed for '" + exp_filename + "'.");
785 }
786 if (locked) {
788 }
789
791
792 // Import colors exported by Gled, if they exist.
793 {
794 TFile f(exp_filename, "READ");
795 TObjArray* collist = (TObjArray*) f.Get("ColorList");
796 f.Close();
797 if (collist != 0) {
799 TGeoVolume* vol;
800 while ((vol = (TGeoVolume*) next()) != 0)
801 {
802 Int_t oldID = vol->GetLineColor();
803 TColor* col = (TColor*)collist->At(oldID);
804 Float_t r, g, b;
805 col->GetRGB(r, g, b);
806 Int_t newID = TColor::GetColor(r,g,b);
807 vol->SetLineColor(newID);
808 }
809 }
810 }
811
812 fGeometries->Add(new TObjString(filename), gGeoManager);
813 }
814 return gGeoManager;
815}
816
817////////////////////////////////////////////////////////////////////////////////
818/// Get geometry with given alias.
819/// The alias must be registered via RegisterGeometryAlias().
820
822{
823 static const TEveException eh("TEveManager::GetGeometry ");
824
825 TObjString* full_name = (TObjString*) fGeometryAliases->GetValue(alias);
826 if (!full_name)
827 throw(eh + "geometry alias '" + alias + "' not registered.");
828 return GetGeometry(full_name->String());
829}
830
831////////////////////////////////////////////////////////////////////////////////
832/// Get the default geometry.
833/// It should be registered via RegisterGeometryName("Default", <URL>).
834
836{
837 return GetGeometryByAlias("Default");
838}
839
840////////////////////////////////////////////////////////////////////////////////
841/// Register 'name' as an alias for geometry file 'filename'.
842/// The old aliases are silently overwritten.
843/// After that the geometry can be retrieved also by calling:
844/// gEve->GetGeometryByName(name);
845
846void TEveManager::RegisterGeometryAlias(const TString& alias, const TString& filename)
847{
848 fGeometryAliases->Add(new TObjString(alias), new TObjString(filename));
849}
850
851////////////////////////////////////////////////////////////////////////////////
852/// Set the text in the right side of browser's status bar.
853
855{
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Work-around uber ugly hack used in SavePrimitive and co.
861
863{
864 TIter nextcl(gROOT->GetListOfClasses());
865 TClass *cls;
866 while((cls = (TClass *)nextcl()))
867 {
869 }
870}
871
872////////////////////////////////////////////////////////////////////////////////
873/// Close button has been clicked on EVE main window (browser).
874/// Cleanup and terminate application.
875
877{
879 TEveBrowser *eb = dynamic_cast<TEveBrowser*>(mf);
880 if (eb == fBrowser)
881 {
882 mf->DontCallClose();
883 Terminate();
885 }
886}
887
888////////////////////////////////////////////////////////////////////////////////
889/// If global TEveManager* gEve is not set initialize it.
890/// Returns gEve.
891
893{
894 static const TEveException eh("TEveManager::Create ");
895
896 if (gEve == 0)
897 {
898 // Make sure that the GUI system is initialized.
899 if (gROOT->IsBatch())
900 {
901 throw eh + "ROOT is running in batch mode.";
902 }
905 if (gROOT->IsBatch() || gClient == 0 || gClient->IsZombie())
906 {
907 throw eh + "window system not initialized.";
908 }
909
910 Int_t w = 1024;
911 Int_t h = 768;
912
915 gEve = new TEveManager(w, h, map_window, opt);
916 }
917 return gEve;
918}
919
920////////////////////////////////////////////////////////////////////////////////
921/// Properly terminate global TEveManager.
922
924{
925 if (!gEve) return;
926
928
929 delete gEve;
930 gEve = 0;
931}
932
933/** \class TEveManager::TExceptionHandler
934\ingroup TEve
935Exception handler for Eve exceptions.
936*/
937
939
940////////////////////////////////////////////////////////////////////////////////
941/// Handle exceptions deriving from TEveException.
942
945{
946 TEveException* ex = dynamic_cast<TEveException*>(&exc);
947 if (ex) {
948 Info("Handle", "%s", ex->Data());
949 gEve->SetStatusLine(ex->Data());
950 gSystem->Beep();
951 return kSEHandled;
952 } else {
953 return kSEProceed;
954 }
955}
ROOT::R::TRInterface & r
Definition: Object.C:4
#define b(i)
Definition: RSha256.hxx:100
#define f(i)
Definition: RSha256.hxx:104
#define c(i)
Definition: RSha256.hxx:101
#define g(i)
Definition: RSha256.hxx:105
#define h(i)
Definition: RSha256.hxx:106
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
long long Long64_t
Definition: RtypesCore.h:80
unsigned long long ULong64_t
Definition: RtypesCore.h:81
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:364
R__EXTERN TApplication * gApplication
Definition: TApplication.h:165
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition: TError.cxx:187
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition: TError.cxx:231
TEveManager * gEve
Definition: TEveManager.cxx:47
#define gClient
Definition: TGClient.h:157
char name[80]
Definition: TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:602
R__EXTERN TGeoIdentity * gGeoIdentity
Definition: TGeoMatrix.h:478
R__EXTERN void * gTQSender
Definition: TQObject.h:44
#define gROOT
Definition: TROOT.h:404
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
void InitializeGraphics()
Initialize the graphics environment.
virtual void Terminate(Int_t status=0)
static void NeedGraphicsLibs()
Static method.
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:33
The Canvas class.
Definition: TCanvas.h:23
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
@ kClassSaved
Definition: TClass.h:94
The color creation and management class.
Definition: TColor.h:19
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
Definition: TColor.h:52
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition: TColor.cxx:1822
Specialization of TRootBrowser for Eve.
Definition: TEveBrowser.h:130
void SanitizeTabCounts()
TRootBrowser keeps (somewhat unnecessarily) counters for number ob tabs on each position.
void InitPlugins(Option_t *opt="FI")
Initialize standard plugins.
A list of TEveElements.
Definition: TEveElement.h:433
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:36
void SaveVizParams(std::ostream &out, const TString &tag, const TString &var)
Save visualization parameters for this element with given tag.
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual TObject * GetEditorObject(const TEveException &eh) const
Definition: TEveElement.h:199
TEveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
void DecDenyDestroy()
Decreases the deny-destroy count of the element.
Bool_t HasChildren() const
Definition: TEveElement.h:171
Short_t fImpliedHighlighted
Definition: TEveElement.h:316
virtual void PropagateVizParamsToProjecteds()
Propagate visualization parameters to dependent elements.
virtual void CollectSceneParents(List_t &scenes)
Collect all parents of class TEveScene.
std::list< TEveElement * > List_t
Definition: TEveElement.h:71
void IncDenyDestroy()
Increases the deny-destroy count of the element.
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
Short_t fImpliedSelected
Definition: TEveElement.h:315
virtual void Destroy()
Destroy this element.
virtual void DestroyElements()
Destroy all children of this element.
virtual TGListTreeItem * AddIntoListTree(TGListTree *ltree, TGListTreeItem *parent_lti)
Add this element into ltree to an already existing item parent_lti.
void SetVizModel(TEveElement *model)
Set visualization-parameter model element.
virtual void RemoveElement(TEveElement *el)
Remove el from the list of children.
virtual Bool_t HandleElementPaste(TEveElement *el)
React to element being pasted or dnd-ed.
virtual void CopyVizParams(const TEveElement *el)
Copy visualization parameters from element el.
virtual void ClearStamps()
Definition: TEveElement.h:404
List_t::iterator List_i
Definition: TEveElement.h:72
virtual Bool_t RemoveFromListTree(TGListTree *ltree, TGListTreeItem *parent_lti)
Remove element from list-tree 'ltree' where its parent item is 'parent_lti'.
UChar_t GetChangeBits() const
Definition: TEveElement.h:406
Base class for event management and navigation.
Exception class thrown by TEve classes and macros.
Definition: TEveUtil.h:102
Composite GUI frame for parallel display of a TGListTree and TEveGedEditor.
Definition: TEveBrowser.h:83
TGListTree * fListTree
Definition: TEveBrowser.h:94
void ConnectSignals()
Connect list-tree signals.
TEveGedEditor * GetEditor() const
Definition: TEveBrowser.h:115
Specialization of TGedEditor for proper update propagation to TEveManager.
Definition: TEveGedEditor.h:27
TEveElement * GetEveElement() const
Return eve-element if it is the model object.
static void ElementDeleted(TEveElement *el)
Element is being deleted. Close editors showing it.
void DisplayElement(TEveElement *re)
Show a TEveElement in editor.
static void DestroyEditors()
Destroys all editors. Called from EVE termination.
static void ElementChanged(TEveElement *el)
Element was changed. Update editors showing it.
Exception handler for Eve exceptions.
Definition: TEveManager.h:72
virtual EStatus Handle(std::exception &exc)
Handle exceptions deriving from TEveException.
Central application manager for Eve.
Definition: TEveManager.h:50
TMap * fVizDB
Definition: TEveManager.h:85
TEveWindowManager * fWindowManager
Definition: TEveManager.h:97
void DoRedraw3D()
Perform 3D redraw of scenes and viewers whose contents has changed.
void ClearOrphanage()
Clear the orphanage.
void SetStatusLine(const char *text)
Set the text in the right side of browser's status bar.
TGStatusBar * GetStatusBar() const
Returns main window status bar.
TEveViewerList * fViewers
Definition: TEveManager.h:98
TGListTree * GetListTree() const
Get default list-tree widget.
TEveElementList * fOrphanage
Definition: TEveManager.h:120
TGeoManager * GetDefaultGeometry()
Get the default geometry.
TTimer fRedrawTimer
Definition: TEveManager.h:111
void RegisterRedraw3D()
Register a request for 3D redraw.
TEveSelection * fSelection
Definition: TEveManager.h:117
Bool_t fDropLogicals
Definition: TEveManager.h:108
void AddElement(TEveElement *element, TEveElement *parent=0)
Add an element.
Bool_t fTimerActive
Definition: TEveManager.h:110
static void Terminate()
Properly terminate global TEveManager.
void CloseEveWindow()
Close button has been clicked on EVE main window (browser).
void ClearROOTClassSaved()
Work-around uber ugly hack used in SavePrimitive and co.
void AddGlobalElement(TEveElement *element, TEveElement *parent=0)
Add a global element, i.e.
void PreDeleteElement(TEveElement *element)
Called from TEveElement prior to its destruction so the framework components (like object editor) can...
TEveGListTreeEditorFrame * fLTEFrame
Definition: TEveManager.h:93
Bool_t fVizDBUpdate
Definition: TEveManager.h:87
TGeoManager * GetGeometryByAlias(const TString &alias)
Get geometry with given alias.
void ScenesChanged(TEveElement::List_t &scenes)
Mark all scenes from the given list as changed.
TGLViewer * GetDefaultGLViewer() const
Get TGLViewer of the default TEveViewer.
TEveViewer * GetDefaultViewer() const
Returns the default viewer - the first one in the fViewers list.
TCanvas * AddCanvasTab(const char *name)
Add a new canvas tab.
TExceptionHandler * fExcHandler
Definition: TEveManager.h:83
TEveScene * fGlobalScene
Definition: TEveManager.h:101
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
Bool_t ElementPaste(TEveElement *element)
Paste has been called.
void ElementChanged(TEveElement *element, Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE)
Element was changed, perform framework side action.
void ElementSelect(TEveElement *element)
Select an element.
virtual ~TEveManager()
Destructor.
void EditElement(TEveElement *element)
Show element in default editor.
TEveBrowser * fBrowser
Definition: TEveManager.h:92
Bool_t InsertVizDBEntry(const TString &tag, TEveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
void RemoveElement(TEveElement *element, TEveElement *parent)
Remove element from parent.
TEveManager(const TEveManager &)
void RegisterGeometryAlias(const TString &alias, const TString &filename)
Register 'name' as an alias for geometry file 'filename'.
TEveSelection * fHighlight
Definition: TEveManager.h:118
TEveGedEditor * GetEditor() const
Returns main object editor.
TEveScene * fEventScene
Definition: TEveManager.h:102
void SaveVizDB(const TString &filename)
Save visualization-parameter database to file filename.
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
TEveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
TMacro * GetMacro(const char *name) const
Find macro in fMacroFolder by name.
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
TGListTreeItem * AddEvent(TEveEventManager *event)
Add a new event and make it the current event.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
Bool_t fVizDBReplace
Definition: TEveManager.h:86
TFolder * fMacroFolder
Definition: TEveManager.h:95
TEveSceneList * fScenes
Definition: TEveManager.h:99
TExMap * fStampedElements
Definition: TEveManager.h:114
Bool_t fResetCameras
Definition: TEveManager.h:107
void RemoveFromListTree(TEveElement *element, TGListTree *lt, TGListTreeItem *lti)
Remove top-level element from list-tree with specified tree-item.
TGWindow * GetMainWindow() const
Get the main window, i.e. EVE-browser.
void LoadVizDB(const TString &filename, Bool_t replace, Bool_t update)
Load visualization-parameter database from file filename.
TMap * fGeometryAliases
Definition: TEveManager.h:90
TGeoManager * GetGeometry(const TString &filename)
Get geometry with given filename.
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
TMap * fGeometries
Definition: TEveManager.h:89
Bool_t fUseOrphanage
Definition: TEveManager.h:121
void ElementStamped(TEveElement *element)
Mark element as changed – it will be processed on next redraw.
TEveEventManager * fCurrentEvent
Definition: TEveManager.h:103
List of Scenes providing common operations on TEveScene collections.
Definition: TEveScene.h:80
void DestroyScenes()
Destroy all scenes and their contents.
Definition: TEveScene.cxx:247
void DestroyElementRenderers(TEveElement *element)
Loop over all scenes and remove all instances of element from them.
Definition: TEveScene.cxx:287
void RepaintAllScenes(Bool_t dropLogicals)
Repaint all scenes.
Definition: TEveScene.cxx:276
void ProcessSceneChanges(Bool_t dropLogicals, TExMap *stampMap)
Loop over all scenes and update them accordingly:
Definition: TEveScene.cxx:307
Eve representation of TGLScene.
Definition: TEveScene.h:27
Make sure there is a SINGLE running TEveSelection for each selection type (select/highlight).
Definition: TEveSelection.h:23
virtual void RemoveImpliedSelected(TEveElement *el)
Remove element from all implied-selected sets.
void SetHighlightMode()
Set to 'highlight' mode.
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
Definition: TEveUtil.cxx:164
static void SetupGUI()
Setup icon pictures and mime-types.
Definition: TEveUtil.cxx:93
static void SetupEnvironment()
Setup Include and Macro paths.
Definition: TEveUtil.cxx:50
List of Viewers providing common operations on TEveViewer collections.
Definition: TEveViewer.h:80
void RepaintChangedViewers(Bool_t resetCameras, Bool_t dropLogicals)
Repaint viewers that are tagged as changed.
Definition: TEveViewer.cxx:437
virtual void AddElement(TEveElement *el)
Call base-class implementation.
Definition: TEveViewer.cxx:358
void RepaintAllViewers(Bool_t resetCameras, Bool_t dropLogicals)
Repaint all viewers.
Definition: TEveViewer.cxx:457
Eve representation of TGLViewer.
Definition: TEveViewer.h:31
TGLViewer * GetGLViewer() const
Definition: TEveViewer.h:51
Manager for EVE windows.
TEveWindowSlot * GetCurrentWindowAsSlot() const
Return current window dynamic-casted to TEveWindowSlot.
void DestroyWindows()
Wait for all windows to shut-down.
Description of TEveWindowSlot.
Definition: TEveWindow.h:302
void ReplaceWindow(TEveWindow *w)
Replace this window with the passed one.
Definition: TEveWindow.cxx:819
static TEveWindowSlot * CreateWindowMainFrame(TEveWindow *eve_parent=0)
Create a new main-frame and populate it with a default window-slot.
Definition: TEveWindow.cxx:977
static TEveWindowSlot * CreateWindowInTab(TGTab *tab, TEveWindow *eve_parent=0)
Create a new tab in a given tab-widget and populate it with a default window-slot.
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
Definition: TExMap.cxx:411
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
void Delete(Option_t *opt="")
Delete all entries stored in the TExMap.
Definition: TExMap.cxx:163
void Remove(ULong64_t hash, Long64_t key)
Remove entry with specified key from the TExMap.
Definition: TExMap.cxx:216
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
Definition: TExMap.cxx:173
void AddAt(UInt_t slot, ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table.
Definition: TExMap.cxx:116
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:30
virtual TObject * FindObject(const char *name) const
Search object identified by name in the tree of folders inside this folder.
Definition: TFolder.cxx:312
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition: TGCanvas.cxx:891
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:276
virtual void MapWindow()
map window
Definition: TGFrame.h:204
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:55
TGListTreeItem * GetParent() const
Definition: TGListTree.h:58
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition: TGListTree.h:195
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:398
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
Definition: TGFrame.cxx:1780
Provides a StatusBar widget.
Definition: TGStatusBar.h:21
ROOT GUI Window base class.
Definition: TGWindow.h:23
virtual TObject * GetModel() const
Definition: TGedEditor.h:79
An identity transformation.
Definition: TGeoMatrix.h:384
The manager class for any TGeo geometry.
Definition: TGeoManager.h:45
static void UnlockGeometry()
Unlock current geometry.
TObjArray * GetListOfVolumes() const
Definition: TGeoManager.h:493
TObjArray * GetListOfMatrices() const
Definition: TGeoManager.h:490
static Bool_t IsLocked()
Check lock state.
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
static function Import a geometry from a gdml or ROOT file
static void LockGeometry()
Lock current geometry so that no other geometry can be imported.
TGeoVolume * GetTopVolume() const
Definition: TGeoManager.h:532
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:49
void VisibleDaughters(Bool_t vis=kTRUE)
set visibility for daughters
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
Definition: TMap.cxx:54
virtual void SetOwnerKeyValue(Bool_t ownkeys=kTRUE, Bool_t ownvals=kTRUE)
Set ownership for keys and values.
Definition: TMap.cxx:352
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition: TMap.cxx:236
TObject * FindObject(const char *keyname) const
Check if a (key,value) pair exists with keyname as name of the key.
Definition: TMap.cxx:215
An array of TObjects.
Definition: TObjArray.h:37
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
Collectable string class.
Definition: TObjString.h:28
TString & String()
Definition: TObjString.h:48
Mother of all ROOT objects.
Definition: TObject.h:37
void ResetBit(UInt_t f)
Definition: TObject.h:186
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:867
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:97
Int_t Substitute(TString &s, const TString &r, Bool_t doDollarSubst=kTRUE)
Substitute matching part of s with r, dollar back-ref substitution is performed if doDollarSubst is t...
Definition: TPRegexp.cxx:872
Int_t Match(const TString &s, UInt_t start=0)
Runs a match on s against the regex 'this' was created with.
Definition: TPRegexp.cxx:706
Class used by TMap to store (key,value) pairs.
Definition: TMap.h:102
void SetValue(TObject *val)
Definition: TMap.h:122
TObject * Value() const
Definition: TMap.h:121
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:869
void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1) override
Start embedding external frame in the tab "pos" and tab element "subpos".
void StopEmbedding(const char *name=nullptr) override
Definition: TRootBrowser.h:152
void SetStatusText(const char *txt, Int_t col) override
Set text in column col in status bar.
TGStatusBar * GetStatusBar() const
Definition: TRootBrowser.h:139
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2314
void Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE)
Beep for duration milliseconds with a tone of frequency freq.
Definition: TSystem.cxx:327
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1274
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:419
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
Definition: TTimer.cxx:211
virtual void Stop()
Definition: TTimer.h:94
TText * text
Double_t ex[n]
Definition: legend1.C:17
static constexpr double s