Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveManager.cxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, 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 <ROOT/REveManager.hxx>
13
14#include <ROOT/REveUtil.hxx>
16#include <ROOT/REveViewer.hxx>
17#include <ROOT/REveScene.hxx>
19#include <ROOT/REveClient.hxx>
20#include <ROOT/RWebWindow.hxx>
21#include <ROOT/RLogger.hxx>
22#include <ROOT/REveSystem.hxx>
23
24#include "TGeoManager.h"
25#include "TGeoMatrix.h"
26#include "TObjString.h"
27#include "TROOT.h"
28#include "TSystem.h"
29#include "TFile.h"
30#include "TMap.h"
31#include "TExMap.h"
32#include "TEnv.h"
33#include "TColor.h"
34#include "TPRegexp.h"
35#include "TClass.h"
36#include "TMethod.h"
37#include "TMethodCall.h"
38#include "THttpServer.h"
39#include "TTimer.h"
40#include "TApplication.h"
41
42#include <fstream>
43#include <sstream>
44#include <iostream>
45#include <regex>
46
47#include <nlohmann/json.hpp>
48
49using namespace ROOT::Experimental;
50namespace REX = ROOT::Experimental;
51
52REveManager *REX::gEve = nullptr;
53
55{
56 std::vector<REveScene*> addedWatch;
57 std::vector<REveScene*> removedWatch;
58
59 void reset() {
60 addedWatch.clear();
61 removedWatch.clear();
62 }
63};
64
65thread_local std::vector<RLogEntry> gEveLogEntries;
67
68/** \class REveManager
69\ingroup REve
70Central application manager for Eve.
71Manages elements, GUI, GL scenes and GL viewers.
72
73Following parameters can be specified in .rootrc file
74
75WebEve.GLViewer: Three # kind of GLViewer, either Three, JSRoot or RCore
76WebEve.DisableShow: 1 # do not start new web browser when REveManager::Show is called
77WebEve.HTimeout: 200 # timeout in ms for elements highlight
78WebEve.DblClick: Off # mouse double click handling in GL viewer: Off or Reset
79WebEve.TableRowHeight: 33 # size of each row in pixels in the Table view, can be used to make design more compact
80*/
81
82////////////////////////////////////////////////////////////////////////////////
83
84REveManager::REveManager()
85 : // (Bool_t map_window, Option_t* opt) :
86 fExcHandler(nullptr), fVizDB(nullptr), fVizDBReplace(kTRUE), fVizDBUpdate(kTRUE), fGeometries(nullptr),
87 fGeometryAliases(nullptr),
88 fKeepEmptyCont(kFALSE)
89{
90 // Constructor.
91
92 static const REveException eh("REveManager::REveManager ");
93
94 if (REX::gEve)
95 throw eh + "There can be only one REve!";
96
97 REX::gEve = this;
98
100 fServerStatus.fTStart = std::time(nullptr);
101
103
104 fGeometries = new TMap;
108 fVizDB = new TMap;
110
111 fElementIdMap[0] = nullptr; // do not increase count for null element.
112
113 fWorld = new REveScene("EveWorld", "Top-level Eve Scene");
116
117 fSelectionList = new REveElement("Selection List");
118 fSelectionList->SetChildClass(TClass::GetClass<REveSelection>());
121 fSelection = new REveSelection("Global Selection", "", kRed, kViolet);
122 fSelection->SetIsMaster(true);
125 fHighlight = new REveSelection("Global Highlight", "", kGreen, kCyan);
126 fHighlight->SetIsMaster(true);
130
131 fViewers = new REveViewerList("Viewers");
134
135 fScenes = new REveSceneList("Scenes");
138
139 fGlobalScene = new REveScene("Geometry scene");
142
143 fEventScene = new REveScene("Event scene");
146
147 {
148 REveViewer *v = SpawnNewViewer("Default Viewer");
149 v->AddScene(fGlobalScene);
150 v->AddScene(fEventScene);
151 }
152
153 // !!! AMT increase threshold to enable color pick on client
155
157 fWebWindow->UseServerThreads();
158 fWebWindow->SetDefaultPage("file:rootui5sys/eve7/index.html");
159
160 const char *gl_viewer = gEnv->GetValue("WebEve.GLViewer", "RCore");
161 const char *gl_dblclick = gEnv->GetValue("WebEve.DblClick", "Off");
162 Int_t htimeout = gEnv->GetValue("WebEve.HTimeout", 250);
163 Int_t table_row_height = gEnv->GetValue("WebEve.TableRowHeight", 0);
164 fWebWindow->SetUserArgs(Form("{ GLViewer: \"%s\", DblClick: \"%s\", HTimeout: %d, TableRowHeight: %d }", gl_viewer,
165 gl_dblclick, htimeout, table_row_height));
166
167 if (strcmp(gl_viewer, "RCore") == 0)
168 fIsRCore = true;
169
170 // this is call-back, invoked when message received via websocket
171 fWebWindow->SetCallBacks([this](unsigned connid) { WindowConnect(connid); },
172 [this](unsigned connid, const std::string &arg) { WindowData(connid, arg); },
173 [this](unsigned connid) { WindowDisconnect(connid); });
174 fWebWindow->SetGeometry(900, 700); // configure predefined window geometry
175 fWebWindow->SetConnLimit(100); // maximal number of connections
176 fWebWindow->SetMaxQueueLength(1000); // number of allowed entries in the window queue
177
178 fMIRExecThread = std::thread{[this] { MIRExecThread(); }};
179
180 // activate interpreter error report
181 gInterpreter->ReportDiagnosticsToErrorHandler();
183}
184
185////////////////////////////////////////////////////////////////////////////////
186/// Destructor.
187
189{
190 fMIRExecThread.join();
191
192 // QQQQ How do we stop THttpServer / fWebWindow?
193
198 // Not needed - no more top-items: fScenes->Destroy();
199 fScenes = nullptr;
200
203 // Not needed - no more top-items: fViewers->Destroy();
204 fViewers = nullptr;
205
206 // fWindowManager->DestroyWindows();
207 // fWindowManager->DecDenyDestroy();
208 // fWindowManager->Destroy();
209 // fWindowManager = 0;
210
213
214 delete fGeometryAliases;
215 delete fGeometries;
216 delete fVizDB;
217 delete fExcHandler;
218}
219
220////////////////////////////////////////////////////////////////////////////////
221/// Create a new GL viewer.
222
223REveViewer *REveManager::SpawnNewViewer(const char *name, const char *title)
224{
225 REveViewer *v = new REveViewer(name, title);
227 return v;
228}
229
230////////////////////////////////////////////////////////////////////////////////
231/// Create a new scene.
232
233REveScene *REveManager::SpawnNewScene(const char *name, const char *title)
234{
235 REveScene *s = new REveScene(name, title);
237 return s;
238}
239
241{
242 printf("REveManager::RegisterRedraw3D() obsolete\n");
243}
244
245////////////////////////////////////////////////////////////////////////////////
246/// Perform 3D redraw of scenes and viewers whose contents has
247/// changed.
248
250{
251 printf("REveManager::DoRedraw3D() obsolete\n");
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// Perform 3D redraw of all scenes and viewers.
256
257void REveManager::FullRedraw3D(Bool_t /*resetCameras*/, Bool_t /*dropLogicals*/)
258{
259 printf("REveManager::FullRedraw3D() obsolete\n");
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Clear all selection objects. Can make things easier for EVE when going to
264/// the next event. Still, destruction os selected object should still work
265/// correctly as long as it is executed within a change cycle.
266
268{
269 for (auto el : fSelectionList->fChildren) {
270 dynamic_cast<REveSelection *>(el)->ClearSelection();
271 }
272}
273
274////////////////////////////////////////////////////////////////////////////////
275/// Add an element. If parent is not specified it is added into
276/// current event (which is created if does not exist).
277
279{
280 if (parent == nullptr) {
281 // XXXX
282 }
283
284 parent->AddElement(element);
285}
286
287////////////////////////////////////////////////////////////////////////////////
288/// Add a global element, i.e. one that does not change on each
289/// event, like geometry or projection manager.
290/// If parent is not specified it is added to a global scene.
291
293{
294 if (!parent)
295 parent = fGlobalScene;
296
297 parent->AddElement(element);
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Remove element from parent.
302
304{
305 parent->RemoveElement(element);
306}
307
308////////////////////////////////////////////////////////////////////////////////
309/// Lookup ElementId in element map and return corresponding REveElement*.
310/// Returns nullptr if the id is not found
311
313{
314 auto it = fElementIdMap.find(id);
315 return (it != fElementIdMap.end()) ? it->second : nullptr;
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Assign a unique ElementId to given element.
320
322{
323 static const REveException eh("REveManager::AssignElementId ");
324
326 throw eh + "ElementId map is full.";
327
328next_free_id:
329 while (fElementIdMap.find(++fLastElementId) != fElementIdMap.end())
330 ;
331 if (fLastElementId == 0)
332 goto next_free_id;
333 // MT - alternatively, we could spawn a thread to find next thousand or so ids and
334 // put them in a vector of ranges. Or collect them when they are freed.
335 // Don't think this won't happen ... online event display can run for months
336 // and easily produce 100000 objects per minute -- about a month to use up all id space!
337
338 element->fElementId = fLastElementId;
339 fElementIdMap.insert(std::make_pair(fLastElementId, element));
341}
342
343////////////////////////////////////////////////////////////////////////////////
344/// Activate EVE browser (summary view) for specified element id
345
347{
348 nlohmann::json msg = {};
349 msg["content"] = "BrowseElement";
350 msg["id"] = id;
351
352 fWebWindow->Send(0, msg.dump());
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Called from REveElement prior to its destruction so the
357/// framework components (like object editor) can unreference it.
358
360{
361 if (el->fImpliedSelected > 0) {
362 for (auto slc : fSelectionList->fChildren) {
363 REveSelection *sel = dynamic_cast<REveSelection *>(slc);
364 sel->RemoveImpliedSelectedReferencesTo(el);
365 }
366
367 if (el->fImpliedSelected != 0)
368 Error("REveManager::PreDeleteElement", "ImpliedSelected not zero (%d) after cleanup of selections.",
369 el->fImpliedSelected);
370 }
371 // Primary selection deregistration is handled through Niece removal from Aunts.
372
373 if (el->fElementId != 0) {
374 auto it = fElementIdMap.find(el->fElementId);
375 if (it != fElementIdMap.end()) {
376 if (it->second == el) {
377 fElementIdMap.erase(it);
379 } else
380 Error("PreDeleteElement", "element ptr in ElementIdMap does not match the argument element.");
381 } else
382 Error("PreDeleteElement", "element id %u was not registered in ElementIdMap.", el->fElementId);
383 } else
384 Error("PreDeleteElement", "element with 0 ElementId passed in.");
385}
386
387////////////////////////////////////////////////////////////////////////////////
388/// Insert a new visualization-parameter database entry. Returns
389/// true if the element is inserted successfully.
390/// If entry with the same key already exists the behaviour depends on the
391/// 'replace' flag:
392/// - true - The old model is deleted and new one is inserted (default).
393/// Clients of the old model are transferred to the new one and
394/// if 'update' flag is true (default), the new model's parameters
395/// are assigned to all clients.
396/// - false - The old model is kept, false is returned.
397///
398/// If insert is successful, the ownership of the model-element is
399/// transferred to the manager.
400
402{
403 TPair *pair = (TPair *)fVizDB->FindObject(tag);
404 if (pair) {
405 if (replace) {
406 model->IncDenyDestroy();
407 model->SetRnrChildren(kFALSE);
408
409 REveElement *old_model = dynamic_cast<REveElement *>(pair->Value());
410 if (old_model) {
411 while (old_model->HasChildren()) {
412 REveElement *el = old_model->FirstChild();
413 el->SetVizModel(model);
414 if (update) {
415 el->CopyVizParams(model);
417 }
418 }
419 old_model->DecDenyDestroy();
420 }
421 pair->SetValue(dynamic_cast<TObject *>(model));
422 return kTRUE;
423 } else {
424 return kFALSE;
425 }
426 } else {
427 model->IncDenyDestroy();
428 model->SetRnrChildren(kFALSE);
429 fVizDB->Add(new TObjString(tag), dynamic_cast<TObject *>(model));
430 return kTRUE;
431 }
432}
433
434////////////////////////////////////////////////////////////////////////////////
435/// Insert a new visualization-parameter database entry with the default
436/// parameters for replace and update, as specified by members
437/// fVizDBReplace(default=kTRUE) and fVizDBUpdate(default=kTRUE).
438/// See docs of the above function.
439
441{
442 return InsertVizDBEntry(tag, model, fVizDBReplace, fVizDBUpdate);
443}
444
445////////////////////////////////////////////////////////////////////////////////
446/// Find a visualization-parameter database entry corresponding to tag.
447/// If the entry is not found 0 is returned.
448
450{
451 return dynamic_cast<REveElement *>(fVizDB->GetValue(tag));
452}
453
454////////////////////////////////////////////////////////////////////////////////
455/// Load visualization-parameter database from file filename. The
456/// replace, update arguments replace the values of fVizDBReplace
457/// and fVizDBUpdate members for the duration of the macro
458/// execution.
459
461{
462 Bool_t ex_replace = fVizDBReplace;
463 Bool_t ex_update = fVizDBUpdate;
464 fVizDBReplace = replace;
466
468
469 fVizDBReplace = ex_replace;
470 fVizDBUpdate = ex_update;
471}
472
473////////////////////////////////////////////////////////////////////////////////
474/// Load visualization-parameter database from file filename.
475/// State of data-members fVizDBReplace and fVizDBUpdate determine
476/// how the registered entries are handled.
477
479{
481 Redraw3D();
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// Save visualization-parameter database to file filename.
486
488{
489 TPMERegexp re("(.+)\\.\\w+");
490 if (re.Match(filename) != 2) {
491 Error("SaveVizDB", "filename does not match required format '(.+)\\.\\w+'.");
492 return;
493 }
494
495 TString exp_filename(filename);
496 gSystem->ExpandPathName(exp_filename);
497
498 std::ofstream out(exp_filename, std::ios::out | std::ios::trunc);
499 out << "void " << re[1] << "()\n";
500 out << "{\n";
501 out << " REveManager::Create();\n";
502
504
505 Int_t var_id = 0;
506 TString var_name;
507 TIter next(fVizDB);
508 TObjString *key;
509 while ((key = (TObjString *)next())) {
510 REveElement *mdl = dynamic_cast<REveElement *>(fVizDB->GetValue(key));
511 if (mdl) {
512 var_name.Form("x%03d", var_id++);
513 mdl->SaveVizParams(out, key->String(), var_name);
514 } else {
515 Warning("SaveVizDB", "Saving failed for key '%s'.", key->String().Data());
516 }
517 }
518
519 out << "}\n";
520 out.close();
521}
522
523////////////////////////////////////////////////////////////////////////////////
524/// Get geometry with given filename.
525/// This is cached internally so the second time this function is
526/// called with the same argument the same geo-manager is returned.
527/// gGeoManager is set to the return value.
528
530{
531 static const REveException eh("REveManager::GetGeometry ");
532
533 TString exp_filename = filename;
534 gSystem->ExpandPathName(exp_filename);
535 printf("REveManager::GetGeometry loading: '%s' -> '%s'.\n", filename.Data(), exp_filename.Data());
536
538 if (gGeoManager) {
540 } else {
541 Bool_t locked = TGeoManager::IsLocked();
542 if (locked) {
543 Warning("REveManager::GetGeometry", "TGeoManager is locked ... unlocking it.");
545 }
546 if (TGeoManager::Import(filename) == 0) {
547 throw eh + "TGeoManager::Import() failed for '" + exp_filename + "'.";
548 }
549 if (locked) {
551 }
552
554
555 // Import colors exported by Gled, if they exist.
556 {
557 TFile f(exp_filename, "READ");
558 TObjArray *collist = (TObjArray *)f.Get("ColorList");
559 f.Close();
560 if (collist) {
562 TGeoVolume *vol;
563 while ((vol = (TGeoVolume *)next()) != nullptr) {
564 Int_t oldID = vol->GetLineColor();
565 TColor *col = (TColor *)collist->At(oldID);
566 Float_t r, g, b;
567 col->GetRGB(r, g, b);
568 Int_t newID = TColor::GetColor(r, g, b);
569 vol->SetLineColor(newID);
570 }
571 }
572 }
573
575 }
576 return gGeoManager;
577}
578
579////////////////////////////////////////////////////////////////////////////////
580/// Get geometry with given alias.
581/// The alias must be registered via RegisterGeometryAlias().
582
584{
585 static const REveException eh("REveManager::GetGeometry ");
586
587 TObjString *full_name = (TObjString *)fGeometryAliases->GetValue(alias);
588 if (!full_name)
589 throw eh + "geometry alias '" + alias + "' not registered.";
590 return GetGeometry(full_name->String());
591}
592
593////////////////////////////////////////////////////////////////////////////////
594/// Get the default geometry.
595/// It should be registered via RegisterGeometryName("Default", `<URL>`).
596
598{
599 return GetGeometryByAlias("Default");
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Register 'name' as an alias for geometry file 'filename'.
604/// The old aliases are silently overwritten.
605/// After that the geometry can be retrieved also by calling:
606/// REX::gEve->GetGeometryByName(name);
607
609{
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// Work-around uber ugly hack used in SavePrimitive and co.
615
617{
618 gROOT->ResetClassSaved();
619}
620
621////////////////////////////////////////////////////////////////////////////////
622/// Register new directory to THttpServer
623// For example: AddLocation("mydir/", "/test/EveWebApp/ui5");
624//
625void REveManager::AddLocation(const std::string &locationName, const std::string &path)
626{
627 fWebWindow->GetServer()->AddLocation(locationName.c_str(), path.c_str());
628}
629
630////////////////////////////////////////////////////////////////////////////////
631/// Set content of default window HTML page
632// Got example: SetDefaultHtmlPage("file:currentdir/test.html")
633//
634void REveManager::SetDefaultHtmlPage(const std::string &path)
635{
636 fWebWindow->SetDefaultPage(path.c_str());
637}
638
639////////////////////////////////////////////////////////////////////////////////
640/// Set client version, used as prefix in scripts URL
641/// When changed, web browser will reload all related JS files while full URL will be different
642/// Default is empty value - no extra string in URL
643/// Version should be string like "1.2" or "ver1.subv2" and not contain any special symbols
644void REveManager::SetClientVersion(const std::string &version)
645{
646 fWebWindow->SetClientVersion(version);
647}
648
649////////////////////////////////////////////////////////////////////////////////
650/// If global REveManager* REX::gEve is not set initialize it.
651/// Returns REX::gEve.
652
654{
655 static const REveException eh("REveManager::Create ");
656
657 if (!REX::gEve) {
658 // XXXX Initialize some server stuff ???
659
660 REX::gEve = new REveManager();
661 }
662 return REX::gEve;
663}
664
665////////////////////////////////////////////////////////////////////////////////
666/// Properly terminate global REveManager.
667
669{
670 if (!REX::gEve)
671 return;
672
673 delete REX::gEve;
674 REX::gEve = nullptr;
675}
676
677void REveManager::ExecuteInMainThread(std::function<void()> func)
678{
679 class XThreadTimer : public TTimer {
680 std::function<void()> foo_;
681 public:
682 XThreadTimer(std::function<void()> f) : foo_(f)
683 {
684 SetTime(0);
686 gSystem->AddTimer(this);
687 }
688 Bool_t Notify() override
689 {
690 foo_();
691 gSystem->RemoveTimer(this);
692 delete this;
693 return kTRUE;
694 }
695 };
696
697 new XThreadTimer(func);
698}
699
701{
703 // QQQQ Should call Terminate() but it needs to:
704 // - properly stop MIRExecThread;
705 // - shutdown civet/THttp/RWebWindow
707 });
708}
709
710////////////////////////////////////////////////////////////////////////////////
711/// Process new connection from web window
712
713void REveManager::WindowConnect(unsigned connid)
714{
715 std::unique_lock<std::mutex> lock(fServerState.fMutex);
716
718 {
719 fServerState.fCV.wait(lock);
720 }
721
722 fConnList.emplace_back(connid);
723 printf("connection established %u\n", connid);
724
725 // QQQQ do we want mir-time here as well? maybe set it at the end of function?
726 // Note, this is all under lock, so nobody will get state out in between.
727 fServerStatus.fTLastMir = fServerStatus.fTLastConnect = std::time(nullptr);
729
730 // This prepares core and render data buffers.
731 printf("\nEVEMNG ............. streaming the world scene.\n");
732
733 fWorld->AddSubscriber(std::make_unique<REveClient>(connid, fWebWindow));
735
736 printf(" sending json, len = %d\n", (int)fWorld->fOutputJson.size());
737 Send(connid, fWorld->fOutputJson);
738 printf(" for now assume world-scene has no render data, binary-size=%d\n", fWorld->fTotalBinarySize);
739 assert(fWorld->fTotalBinarySize == 0);
740
741 for (auto &c : fScenes->RefChildren()) {
742 REveScene *scene = dynamic_cast<REveScene *>(c);
743 if (!scene->GetMandatory())
744 continue;
745
746 scene->AddSubscriber(std::make_unique<REveClient>(connid, fWebWindow));
747 printf("\nEVEMNG ............. streaming scene %s [%s]\n", scene->GetCTitle(), scene->GetCName());
748
749 // This prepares core and render data buffers.
750 scene->StreamElements();
751
752 printf(" sending json, len = %d\n", (int)scene->fOutputJson.size());
753 Send(connid, scene->fOutputJson);
754
755 if (scene->fTotalBinarySize > 0) {
756 printf(" sending binary, len = %d\n", scene->fTotalBinarySize);
757 SendBinary(connid, &scene->fOutputBinary[0], scene->fTotalBinarySize);
758 } else {
759 printf(" NOT sending binary, len = %d\n", scene->fTotalBinarySize);
760 }
761 }
762
763 fServerState.fCV.notify_all();
764}
765
766////////////////////////////////////////////////////////////////////////////////
767/// Process disconnect of web window
768
769void REveManager::WindowDisconnect(unsigned connid)
770{
771 std::unique_lock<std::mutex> lock(fServerState.fMutex);
772 auto conn = fConnList.end();
773 for (auto i = fConnList.begin(); i != fConnList.end(); ++i) {
774 if (i->fId == connid) {
775 conn = i;
776 break;
777 }
778 }
779 // this should not happen, just check
780 if (conn == fConnList.end()) {
781 printf("error, connection not found!");
782 } else {
783 printf("connection closed %u\n", connid);
784 fConnList.erase(conn);
785 for (auto &c : fScenes->RefChildren()) {
786 REveScene *scene = dynamic_cast<REveScene *>(c);
787 scene->RemoveSubscriber(connid);
788 }
789 fWorld->RemoveSubscriber(connid);
790 }
791
792 // User case: someone can close browser tab as clients are updateding
793 // note if scene changes are in progess the new serverstate will be changes after finish those
795 {
797 }
798
799 fServerStatus.fTLastDisconnect = std::time(nullptr);
801
802 fServerState.fCV.notify_all();
803}
804
805////////////////////////////////////////////////////////////////////////////////
806/// Process data from web window
807
808void REveManager::WindowData(unsigned connid, const std::string &arg)
809{
810 static const REveException eh("REveManager::WindowData ");
811
812 // find connection object
813 bool found = false;
814 for (auto &conn : fConnList) {
815 if (conn.fId == connid) {
816 found = true;
817 break;
818 }
819 }
820
821 // this should not happen, just check
822 if (!found) {
823 R__LOG_ERROR(REveLog()) << "Internal error - no connection with id " << connid << " found";
824 return;
825 }
826
827
828 if (arg.compare("__REveDoneChanges") == 0)
829 {
830 // client status data
831 std::unique_lock<std::mutex> lock(fServerState.fMutex);
832
833 for (auto &conn : fConnList) {
834 if (conn.fId == connid) {
835 conn.fState = Conn::Free;
836 break;
837 }
838 }
839
842 fServerState.fCV.notify_all();
843 }
844
845 return;
846 }
848 {
849 // file dialog
851 return;
852 }
853
854 nlohmann::json cj = nlohmann::json::parse(arg);
855 if (gDebug > 0)
856 ::Info("REveManager::WindowData", "MIR test %s\n", cj.dump().c_str());
857
858 std::string cmd = cj["mir"];
859 int id = cj["fElementId"];
860 std::string ctype = cj["class"];
861
862 ScheduleMIR(cmd, id, ctype, connid);
863}
864
865//
866//____________________________________________________________________
867void REveManager::ScheduleMIR(const std::string &cmd, ElementId_t id, const std::string& ctype, unsigned connid)
868{
869 std::unique_lock<std::mutex> lock(fServerState.fMutex);
870 fServerStatus.fTLastMir = std::time(nullptr);
871 fMIRqueue.push(std::shared_ptr<MIR>(new MIR(cmd, id, ctype, connid)));
872
873 if (fMIRqueue.size() > 5)
874 std::cout << "Warning, REveManager::ScheduleMIR(). queue size " << fMIRqueue.size() << std::endl;
875
877 fServerState.fCV.notify_all();
878}
879
880//
881//____________________________________________________________________
882void REveManager::ExecuteMIR(std::shared_ptr<MIR> mir)
883{
884 static const REveException eh("REveManager::ExecuteMIR ");
885
886 //if (gDebug > 0)
887 ::Info("REveManager::ExecuteCommand", "MIR cmd %s", mir->fCmd.c_str());
888
889 try {
890 REveElement *el = FindElementById(mir->fId);
891 if ( ! el) throw eh + "Element with id " + mir->fId + " not found";
892
893 static const std::regex cmd_re("^(\\w[\\w\\d]*)\\(\\s*(.*)\\s*\\)\\s*;?\\s*$", std::regex::optimize);
894 std::smatch m;
895 std::regex_search(mir->fCmd, m, cmd_re);
896 if (m.size() != 3)
897 throw eh + "Command string parse error: '" + mir->fCmd + "'.";
898
899 static const TClass *elem_cls = TClass::GetClass<REX::REveElement>();
900
901 TClass *call_cls = TClass::GetClass(mir->fCtype.c_str());
902 if ( ! call_cls)
903 throw eh + "Class '" + mir->fCtype + "' not found.";
904
905 void *el_casted = call_cls->DynamicCast(elem_cls, el, false);
906 if ( ! el_casted)
907 throw eh + "Dynamic cast from REveElement to '" + mir->fCtype + "' failed.";
908
909 std::string tag(mir->fCtype + "::" + m.str(1));
910 std::shared_ptr<TMethodCall> mc;
911
912 auto mmi = fMethCallMap.find(tag);
913 if (mmi != fMethCallMap.end())
914 {
915 mc = mmi->second;
916 }
917 else
918 {
919 const TMethod *meth = call_cls->GetMethodAllAny(m.str(1).c_str());
920 if ( ! meth)
921 throw eh + "Can not find TMethod matching '" + m.str(1) + "'.";
922 mc = std::make_shared<TMethodCall>(meth);
923 fMethCallMap.insert(std::make_pair(tag, mc));
924 }
925
927 mc->Execute(el_casted, m.str(2).c_str());
928
929 // Alternative implementation through Cling. "Leaks" 200 kB per call.
930 // This might be needed for function calls that involve data-types TMethodCall
931 // can not handle.
932 // std::stringstream cmd;
933 // cmd << "((" << mir->fCtype << "*)" << std::hex << std::showbase << (size_t)el << ")->" << mir->fCmd << ";";
934 // std::cout << cmd.str() << std::endl;
935 // gROOT->ProcessLine(cmd.str().c_str());
936 } catch (std::exception &e) {
937 R__LOG_ERROR(REveLog()) << "REveManager::ExecuteCommand " << e.what() << std::endl;
938 } catch (...) {
939 R__LOG_ERROR(REveLog()) << "REveManager::ExecuteCommand unknow execption \n";
940 }
941}
942
943// Write scene change into scenes's internal json member
945{
947
948 for (auto &el : fScenes->RefChildren())
949 {
950 REveScene* s = dynamic_cast<REveScene*>(el);
952 }
953}
954
955// Send json and binary data to scene's connections
957{
958 // send begin message
959 nlohmann::json jobj = {};
960 jobj["content"] = "BeginChanges";
961 fWebWindow->Send(0, jobj.dump());
962
963 // send the change json
965
966 for (auto &el : fScenes->RefChildren())
967 {
968 REveScene* s = dynamic_cast<REveScene*>(el);
970 }
971
972 // send end changes message and log messages
973 jobj["content"] = "EndChanges";
974
975 if (!gEveLogEntries.empty()) {
976 constexpr static int numLevels = static_cast<int>(ELogLevel::kDebug) + 1;
977 constexpr static std::array<const char *, numLevels> sTag{
978 {"{unset-error-level please report}", "FATAL", "Error", "Warning", "Info", "Debug"}};
979
980 jobj["log"] = nlohmann::json::array();
981 std::stringstream strm;
982 for (auto entry : gEveLogEntries) {
983 nlohmann::json item = {};
984 item["lvl"] = entry.fLevel;
985 int cappedLevel = std::min(static_cast<int>(entry.fLevel), numLevels - 1);
986 strm << "Server " << sTag[cappedLevel] << ":";
987
988 if (!entry.fLocation.fFuncName.empty())
989 strm << " " << entry.fLocation.fFuncName;
990 strm << " " << entry.fMessage;
991 item["msg"] = strm.str();
992 jobj["log"].push_back(item);
993 strm.clear();
994 }
995 gEveLogEntries.clear();
996 }
997
998 fWebWindow->Send(0, jobj.dump());
999}
1000
1001//
1002//____________________________________________________________________
1004{
1005#if defined(R__LINUX)
1006 pthread_setname_np(pthread_self(), "mir_exec");
1007#endif
1008 while (true)
1009 {
1010 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1011 underlock:
1013 {
1014 fServerState.fCV.wait(lock);
1015 goto underlock;
1016 }
1017 else
1018 {
1019 // set server state and update the queue under lock
1020 //
1022 std::shared_ptr<MIR> mir = fMIRqueue.front();
1023
1024 // reset local thread related data
1025 gMIRData.reset();
1026 fMIRqueue.pop();
1027
1028 lock.unlock();
1029
1030 // allow scenes to accept changes in the element
1032 gEve->GetScenes()->AcceptChanges(true);
1033
1034 ExecuteMIR(mir);
1035
1036 // disable scene's element changing
1037 gEve->GetScenes()->AcceptChanges(false);
1039
1041
1042 // send changes (need to access client connection list) and set the state under lock
1043 //
1044 lock.lock();
1045
1046 // disconnect requested scene from clients
1047 for (auto &scene : gMIRData.removedWatch)
1048 scene->RemoveSubscriber(mir->fConnId);
1049
1050
1051 // connect and stream scenes to new clients
1052 for (auto &scene : gMIRData.addedWatch) {
1053 scene->AddSubscriber(std::make_unique<REveClient>(mir->fConnId, fWebWindow));
1054 scene->StreamElements();
1055 Send(mir->fConnId, scene->fOutputJson);
1056 if (scene->fTotalBinarySize > 0)
1057 SendBinary(mir->fConnId, &scene->fOutputBinary[0], scene->fTotalBinarySize);
1058 }
1059
1061
1063 fServerState.fCV.notify_all();
1064 }
1065 }
1066}
1067
1068//____________________________________________________________________
1070{
1071 for (auto &c : view->RefChildren()) {
1072 REveSceneInfo *sinfo = dynamic_cast<REveSceneInfo *>(c);
1073 std::cout << "Disconnect scee " << sinfo->GetScene()->GetName();
1074 gMIRData.removedWatch.push_back(sinfo->GetScene());
1075 }
1076}
1077//____________________________________________________________________
1079{
1080 view->StampObjProps();
1081 for (auto &c : view->RefChildren()) {
1082 REveSceneInfo *sinfo = dynamic_cast<REveSceneInfo *>(c);
1083 std::cout << "Connect scene " << sinfo->GetScene()->GetName();
1084 gMIRData.addedWatch.push_back(sinfo->GetScene());
1085 }
1086}
1087
1088//____________________________________________________________________
1089void REveManager::Send(unsigned connid, const std::string &data)
1090{
1091 fWebWindow->Send(connid, data);
1092}
1093
1094void REveManager::SendBinary(unsigned connid, const void *data, std::size_t len)
1095{
1096 fWebWindow->SendBinary(connid, data, len);
1097}
1098
1100{
1101 for (auto &conn : fConnList) {
1102 if (conn.fState != Conn::Free)
1103 return false;
1104 }
1105
1106 return true;
1107}
1108
1109// called from REveScene::SendChangesToSubscribers
1111{
1112 for (auto &conn : fConnList) {
1113 if (conn.fId == cinnId)
1114 {
1115 conn.fState = Conn::WaitingResponse;
1116 break;
1117 }
1118 }
1119}
1120
1121//////////////////////////////////////////////////////////////////
1122/// Show eve manager in specified browser.
1123
1124/// If rootrc variable WebEve.DisableShow is set, HTTP server will be
1125/// started and access URL printed on stdout.
1126
1128{
1129 if (gEnv->GetValue("WebEve.DisableShow", 0) != 0) {
1130 std::string url = fWebWindow->GetUrl(true);
1131 printf("EVE URL %s\n", url.c_str());
1132 } else {
1133 fWebWindow->Show(args);
1134 }
1135}
1136
1137
1138//____________________________________________________________________
1140{
1141 // set server state and tag scenes to begin accepting changees
1142 {
1143 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1145 fServerState.fCV.wait(lock);
1146 }
1148 }
1150 GetScenes()->AcceptChanges(true);
1151}
1152
1153//____________________________________________________________________
1155{
1156 // tag scene to disable accepting chages, write the change json
1157 GetScenes()->AcceptChanges(false);
1159
1161
1162 // set new server state under lock
1163 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1166 fServerState.fCV.notify_all();
1167}
1168
1169//____________________________________________________________________
1171{
1172 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1174#if defined(_MSC_VER)
1175 std::timespec_get(&fServerStatus.fTReport, TIME_UTC);
1176#else
1177 fServerStatus.fTReport = std::time_t(nullptr);
1178#endif
1179 st = fServerStatus;
1180}
1181
1182/** \class REveManager::ChangeGuard
1183\ingroup REve
1184RAII guard for locking Eve manager (ctor) and processing changes (dtor).
1185*/
1186
1187//////////////////////////////////////////////////////////////////////
1188//
1189// Helper struct to guard update mechanism
1190//
1192{
1193 gEve->BeginChange();
1194}
1195
1197{
1198 gEve->EndChange();
1199}
1200
1201// Error handler streams error-level messages to client log
1202void REveManager::ErrorHandler(Int_t level, Bool_t abort, const char * location, const char *msg)
1203{
1204 if (level >= kError)
1205 {
1207 entry.fMessage = msg;
1208 gEveLogEntries.emplace_back(entry);
1209 }
1210 ::DefaultErrorHandler(level, abort, location, msg);
1211}
1212
1213/** \class REveManager::RExceptionHandler
1214\ingroup REve
1215Exception handler for Eve exceptions.
1216*/
1217
1218////////////////////////////////////////////////////////////////////////////////
1219/// Handle exceptions deriving from REveException.
1220
1222{
1223 REveException *ex = dynamic_cast<REveException *>(&exc);
1224 if (ex) {
1225 Info("Handle", "Exception %s", ex->what());
1226 // REX::gEve->SetStatusLine(ex->Data());
1227 gSystem->Beep();
1228 return kSEHandled;
1229 }
1230 return kSEProceed;
1231}
1232
1233
1234////////////////////////////////////////////////////////////////////////////////
1235/// Utility to stream loggs to client.
1236
1238{
1239 gEveLogEntries.emplace_back(entry);
1240 return true;
1241}
thread_local MIR_TL_Data_t gMIRData
thread_local std::vector< RLogEntry > gEveLogEntries
#define R__LOG_ERROR(...)
Definition RLogger.hxx:362
#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 e(i)
Definition RSha256.hxx:103
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
@ kRed
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:66
@ kCyan
Definition Rtypes.h:66
@ kViolet
Definition Rtypes.h:67
R__EXTERN TApplication * gApplication
R__EXTERN TEnv * gEnv
Definition TEnv.h:170
void DefaultErrorHandler(Int_t level, Bool_t abort_bool, const char *location, const char *msg)
The default error handler function.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:218
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
ErrorHandlerFunc_t SetErrorHandler(ErrorHandlerFunc_t newhandler)
Set an errorhandler function. Returns the old handler.
Definition TError.cxx:90
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
R__EXTERN TGeoIdentity * gGeoIdentity
Definition TGeoMatrix.h:537
R__EXTERN TVirtualMutex * gInterpreterMutex
#define R__LOCKGUARD_CLING(mutex)
#define gInterpreter
Int_t gDebug
Definition TROOT.cxx:597
#define gROOT
Definition TROOT.h:407
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2467
R__EXTERN TVirtualMutex * gSystemMutex
Definition TSystem.h:244
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
#define R__LOCKGUARD2(mutex)
void DecDenyDestroy()
Decreases the deny-destroy count of the element.
const std::string & GetName() const
void SaveVizParams(std::ostream &out, const TString &tag, const TString &var)
Save visualization parameters for this element with given tag.
const char * GetCTitle() const
const char * GetCName() const
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
virtual void DestroyElements()
Destroy all children of this element.
REveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
void IncDenyDestroy()
Increases the deny-destroy count of the element.
virtual void CopyVizParams(const REveElement *el)
Copy visualization parameters from element el.
void SetVizModel(REveElement *model)
Set visualization-parameter model element.
virtual void RemoveElement(REveElement *el)
Remove el from the list of children.
virtual void PropagateVizParamsToProjecteds()
Propagate visualization parameters to dependent elements.
REveException Exception-type thrown by Eve classes.
Definition REveTypes.hxx:41
bool Emit(const RLogEntry &entry) override
Utility to stream loggs to client.
virtual EStatus Handle(std::exception &exc)
Handle exceptions deriving from REveException.
void DisconnectEveViewer(REveViewer *)
void ScheduleMIR(const std::string &cmd, ElementId_t i, const std::string &ctype, unsigned connid)
void ClearROOTClassSaved()
Work-around uber ugly hack used in SavePrimitive and co.
std::shared_ptr< ROOT::RWebWindow > fWebWindow
void RegisterGeometryAlias(const TString &alias, const TString &filename)
Register 'name' as an alias for geometry file 'filename'.
void PreDeleteElement(REveElement *element)
Called from REveElement prior to its destruction so the framework components (like object editor) can...
void ExecuteMIR(std::shared_ptr< MIR > mir)
REveSceneList * GetScenes() const
void ClearAllSelections()
Clear all selection objects.
RExceptionHandler * fExcHandler
exception handler
void AssignElementId(REveElement *element)
Assign a unique ElementId to given element.
TGeoManager * GetDefaultGeometry()
Get the default geometry.
static void ExecuteInMainThread(std::function< void()> func)
void GetServerStatus(REveServerStatus &)
void SetDefaultHtmlPage(const std::string &path)
Set content of default window HTML page.
void AddLocation(const std::string &name, const std::string &path)
Register new directory to THttpServer.
void Send(unsigned connid, const std::string &data)
static void Terminate()
Properly terminate global REveManager.
REveElement * FindElementById(ElementId_t id) const
Lookup ElementId in element map and return corresponding REveElement*.
void SaveVizDB(const TString &filename)
Save visualization-parameter database to file filename.
TGeoManager * GetGeometryByAlias(const TString &alias)
Get geometry with given alias.
std::unordered_map< ElementId_t, REveElement * > fElementIdMap
static REveManager * Create()
If global REveManager* REX::gEve is not set initialize it.
std::unordered_map< std::string, std::shared_ptr< TMethodCall > > fMethCallMap
void WindowConnect(unsigned connid)
Process new connection from web window.
REveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
TGeoManager * GetGeometry(const TString &filename)
Get geometry with given filename.
void ConnectEveViewer(REveViewer *)
static void ErrorHandler(Int_t level, Bool_t abort, const char *location, const char *msg)
std::queue< std::shared_ptr< MIR > > fMIRqueue
void LoadVizDB(const TString &filename, Bool_t replace, Bool_t update)
Load visualization-parameter database from file filename.
void DoRedraw3D()
Perform 3D redraw of scenes and viewers whose contents has changed.
void SendBinary(unsigned connid, const void *data, std::size_t len)
void AddElement(REveElement *element, REveElement *parent=nullptr)
Add an element.
void SetClientVersion(const std::string &version)
Set client version, used as prefix in scripts URL When changed, web browser will reload all related J...
void AddGlobalElement(REveElement *element, REveElement *parent=nullptr)
Add a global element, i.e.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
void SceneSubscriberWaitingResponse(unsigned cinnId)
REveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
void RemoveElement(REveElement *element, REveElement *parent)
Remove element from parent.
virtual ~REveManager()
Destructor.
void WindowDisconnect(unsigned connid)
Process disconnect of web window.
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
REveViewer * SpawnNewViewer(const char *name, const char *title="")
Create a new GL viewer.
Bool_t InsertVizDBEntry(const TString &tag, REveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
void BrowseElement(ElementId_t id)
Activate EVE browser (summary view) for specified element id.
void WindowData(unsigned connid, const std::string &arg)
Process data from web window.
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
REveSceneInfo Scene in a viewer.
void DestroyScenes()
Destroy all scenes and their contents.
void AcceptChanges(bool)
Set accept changes flag on all scenes.
void AddSubscriber(std::unique_ptr< REveClient > &&sub)
Definition REveScene.cxx:67
std::vector< char > fOutputBinary
!
Definition REveScene.hxx:78
void StreamRepresentationChanges()
Prepare data for sending element changes.
void RemoveSubscriber(unsigned int)
Definition REveScene.cxx:78
REveSelection Container for selected and highlighted elements.
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
Definition REveUtil.cxx:94
REveViewerList List of Viewers providing common operations on REveViewer collections.
void AddElement(REveElement *el) override
Call base-class implementation.
REveViewer Reve representation of TGLViewer.
A diagnostic that can be emitted by the RLogManager.
Definition RLogger.hxx:178
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
static bool EmbedFileDialog(const std::shared_ptr< RWebWindow > &window, unsigned connid, const std::string &args)
Create dialog instance to use as embedded dialog inside provided widget Loads libROOTBrowserv7 and tr...
static bool IsFileDialogMessage(const std::string &msg)
Check if this could be the message send by client to start new file dialog If returns true,...
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:33
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
void * DynamicCast(const TClass *base, void *obj, Bool_t up=kTRUE)
Cast obj of this class type up to baseclass cl if up is true.
Definition TClass.cxx:4915
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Definition TClass.cxx:4384
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2968
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:1823
static void SetColorThreshold(Float_t t)
This method specifies the color threshold used by GetColor to retrieve a color.
Definition TColor.cxx:1895
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:491
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
An identity transformation.
Definition TGeoMatrix.h:406
The manager class for any TGeo geometry.
Definition TGeoManager.h:44
static void UnlockGeometry()
Unlock current geometry.
TObjArray * GetListOfVolumes() const
TObjArray * GetListOfMatrices() const
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
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
void VisibleDaughters(Bool_t vis=kTRUE)
set visibility for daughters
void SetLineColor(Color_t lcolor) override
Set the line color.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition TMap.h:40
void Add(TObject *obj) override
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 * FindObject(const char *keyname) const override
Check if a (key,value) pair exists with keyname as name of the key.
Definition TMap.cxx:215
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition TMap.cxx:236
Each ROOT class (see TClass) has a linked list of methods.
Definition TMethod.h:38
An array of TObjects.
Definition TObjArray.h:31
TObject * At(Int_t idx) const override
Definition TObjArray.h:164
Collectable string class.
Definition TObjString.h:28
TString & String()
Definition TObjString.h:48
Mother of all ROOT objects.
Definition TObject.h:41
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition TPRegexp.h:97
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
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:380
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2334
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:311
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition TSystem.cxx:1261
virtual int GetPid()
Get process id.
Definition TSystem.cxx:694
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Definition TSystem.cxx:458
virtual int GetProcInfo(ProcInfo_t *info) const
Returns cpu and memory used by this process into the ProcInfo_t structure.
Definition TSystem.cxx:2474
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
Definition TSystem.cxx:468
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
Double_t ex[n]
Definition legend1.C:17
R__EXTERN REveManager * gEve
@ kDebug
Debug information; only useful for developers; can have added verbosity up to 255-kDebug.
RLogChannel & REveLog()
Log channel for Eve diagnostics.
Definition REveTypes.cxx:47
std::vector< REveScene * > removedWatch
std::vector< REveScene * > addedWatch
TMarker m
Definition textangle.C:8