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>
25
26#include "TGeoManager.h"
27#include "TGeoMatrix.h"
28#include "TObjString.h"
29#include "TROOT.h"
30#include "TSystem.h"
31#include "TFile.h"
32#include "TMap.h"
33#include "TExMap.h"
34#include "TEnv.h"
35#include "TColor.h"
36#include "TPRegexp.h"
37#include "TClass.h"
38#include "TMethod.h"
39#include "TMethodCall.h"
40#include "THttpServer.h"
41#include "TTimer.h"
42#include "TApplication.h"
43
44#include <fstream>
45#include <memory>
46#include <sstream>
47#include <iostream>
48#include <regex>
49
50#include <nlohmann/json.hpp>
51
52using namespace ROOT::Experimental;
53namespace REX = ROOT::Experimental;
54
55REveManager *REX::gEve = nullptr;
56
58{
59 std::vector<REveScene*> addedWatch;
60 std::vector<REveScene*> removedWatch;
61
62 void reset() {
63 addedWatch.clear();
64 removedWatch.clear();
65 }
66};
67
68thread_local std::vector<RLogEntry> gEveLogEntries;
70
71/** \class REveManager
72\ingroup REve
73\ingroup webwidgets
74
75\brief Central application manager for web-based REve.
76
77Manages elements, GUI, GL scenes and GL viewers.
78
79Following parameters can be specified in .rootrc file
80
81WebEve.GLViewer: Three # kind of GLViewer, either Three, JSRoot or RCore
82WebEve.DisableShow: 1 # do not start new web browser when REveManager::Show is called
83WebEve.HTimeout: 200 # timeout in ms for elements highlight
84WebEve.DblClick: Off # mouse double click handling in GL viewer: Off or Reset
85WebEve.TableRowHeight: 33 # size of each row in pixels in the Table view, can be used to make design more compact
86*/
87
88////////////////////////////////////////////////////////////////////////////////
89
90REveManager::REveManager()
91 : // (Bool_t map_window, Option_t* opt) :
92 fExcHandler(nullptr), fVizDB(nullptr), fVizDBReplace(kTRUE), fVizDBUpdate(kTRUE), fGeometries(nullptr),
93 fGeometryAliases(nullptr),
94 fKeepEmptyCont(kFALSE)
95{
96 // Constructor.
97
98 static const REveException eh("REveManager::REveManager ");
99
100 if (REX::gEve)
101 throw eh + "There can be only one REve!";
102
103 REX::gEve = this;
104
106 fServerStatus.fTStart = std::time(nullptr);
107
109
110 fGeometries = new TMap;
114 fVizDB = new TMap;
116
117 fElementIdMap[0] = nullptr; // do not increase count for null element.
118
119 fWorld = new REveScene("EveWorld", "Top-level Eve Scene");
122
123 fSelectionList = new REveElement("Selection List");
124 fSelectionList->SetChildClass(TClass::GetClass<REveSelection>());
127 fSelection = new REveSelection("Global Selection", "", kRed, kViolet);
128 fSelection->SetIsMaster(true);
131 fHighlight = new REveSelection("Global Highlight", "", kGreen, kCyan);
132 fHighlight->SetIsMaster(true);
136
137 fViewers = new REveViewerList("Viewers");
140
141 fScenes = new REveSceneList("Scenes");
144
145 fGlobalScene = new REveScene("Geometry scene");
148
149 fEventScene = new REveScene("Event scene");
152
153 {
154 REveViewer *v = SpawnNewViewer("Default Viewer");
155 v->AddScene(fGlobalScene);
156 v->AddScene(fEventScene);
157 }
158
159 // !!! AMT increase threshold to enable color pick on client
161
162 // allow multiple connections
164
166 fWebWindow->UseServerThreads();
167 fWebWindow->SetDefaultPage("file:rootui5sys/eve7/index.html");
168
169 const char *gl_viewer = gEnv->GetValue("WebEve.GLViewer", "RCore");
170 const char *gl_dblclick = gEnv->GetValue("WebEve.DblClick", "Off");
171 Int_t htimeout = gEnv->GetValue("WebEve.HTimeout", 250);
172 Int_t table_row_height = gEnv->GetValue("WebEve.TableRowHeight", 0);
173 fWebWindow->SetUserArgs(Form("{ GLViewer: \"%s\", DblClick: \"%s\", HTimeout: %d, TableRowHeight: %d }", gl_viewer,
174 gl_dblclick, htimeout, table_row_height));
175
176 if (strcmp(gl_viewer, "RCore") == 0)
177 fIsRCore = true;
178
179 // this is call-back, invoked when message received via websocket
180 fWebWindow->SetCallBacks([this](unsigned connid) { WindowConnect(connid); },
181 [this](unsigned connid, const std::string &arg) { WindowData(connid, arg); },
182 [this](unsigned connid) { WindowDisconnect(connid); });
183 fWebWindow->SetGeometry(900, 700); // configure predefined window geometry
184 fWebWindow->SetConnLimit(100); // maximal number of connections
185 fWebWindow->SetMaxQueueLength(1000); // number of allowed entries in the window queue
186
187 fMIRExecThread = std::thread{[this] { MIRExecThread(); }};
188
189 // activate interpreter error report
190 gInterpreter->ReportDiagnosticsToErrorHandler();
192}
193
194////////////////////////////////////////////////////////////////////////////////
195/// Destructor.
196
198{
199 fMIRExecThread.join();
200
201 // QQQQ How do we stop THttpServer / fWebWindow?
202
207 // Not needed - no more top-items: fScenes->Destroy();
208 fScenes = nullptr;
209
212 // Not needed - no more top-items: fViewers->Destroy();
213 fViewers = nullptr;
214
215 // fWindowManager->DestroyWindows();
216 // fWindowManager->DecDenyDestroy();
217 // fWindowManager->Destroy();
218 // fWindowManager = 0;
219
222
223 delete fGeometryAliases;
224 delete fGeometries;
225 delete fVizDB;
226 delete fExcHandler;
227}
228
229////////////////////////////////////////////////////////////////////////////////
230/// Create a new GL viewer.
231
232REveViewer *REveManager::SpawnNewViewer(const char *name, const char *title)
233{
234 REveViewer *v = new REveViewer(name, title);
236 return v;
237}
238
239////////////////////////////////////////////////////////////////////////////////
240/// Create a new scene.
241
242REveScene *REveManager::SpawnNewScene(const char *name, const char *title)
243{
244 REveScene *s = new REveScene(name, title);
246 return s;
247}
248
250{
251 printf("REveManager::RegisterRedraw3D() obsolete\n");
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// Perform 3D redraw of scenes and viewers whose contents has
256/// changed.
257
259{
260 printf("REveManager::DoRedraw3D() obsolete\n");
261}
262
263////////////////////////////////////////////////////////////////////////////////
264/// Perform 3D redraw of all scenes and viewers.
265
266void REveManager::FullRedraw3D(Bool_t /*resetCameras*/, Bool_t /*dropLogicals*/)
267{
268 printf("REveManager::FullRedraw3D() obsolete\n");
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Clear all selection objects. Can make things easier for EVE when going to
273/// the next event. Still, destruction os selected object should still work
274/// correctly as long as it is executed within a change cycle.
275
277{
278 for (auto el : fSelectionList->fChildren) {
279 dynamic_cast<REveSelection *>(el)->ClearSelection();
280 }
281}
282
283////////////////////////////////////////////////////////////////////////////////
284/// Add an element. If parent is not specified it is added into
285/// current event (which is created if does not exist).
286
288{
289 if (parent == nullptr) {
290 // XXXX
291 }
292
293 parent->AddElement(element);
294}
295
296////////////////////////////////////////////////////////////////////////////////
297/// Add a global element, i.e. one that does not change on each
298/// event, like geometry or projection manager.
299/// If parent is not specified it is added to a global scene.
300
302{
303 if (!parent)
304 parent = fGlobalScene;
305
306 parent->AddElement(element);
307}
308
309////////////////////////////////////////////////////////////////////////////////
310/// Remove element from parent.
311
313{
314 parent->RemoveElement(element);
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Lookup ElementId in element map and return corresponding REveElement*.
319/// Returns nullptr if the id is not found
320
322{
323 auto it = fElementIdMap.find(id);
324 return (it != fElementIdMap.end()) ? it->second : nullptr;
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Assign a unique ElementId to given element.
329
331{
332 static const REveException eh("REveManager::AssignElementId ");
333
335 throw eh + "ElementId map is full.";
336
337next_free_id:
338 while (fElementIdMap.find(++fLastElementId) != fElementIdMap.end())
339 ;
340 if (fLastElementId == 0)
341 goto next_free_id;
342 // MT - alternatively, we could spawn a thread to find next thousand or so ids and
343 // put them in a vector of ranges. Or collect them when they are freed.
344 // Don't think this won't happen ... online event display can run for months
345 // and easily produce 100000 objects per minute -- about a month to use up all id space!
346
347 element->fElementId = fLastElementId;
348 fElementIdMap.insert(std::make_pair(fLastElementId, element));
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Activate EVE browser (summary view) for specified element id
354
356{
357 nlohmann::json msg = {};
358 msg["content"] = "BrowseElement";
359 msg["id"] = id;
360
361 fWebWindow->Send(0, msg.dump());
362}
363
364////////////////////////////////////////////////////////////////////////////////
365/// Called from REveElement prior to its destruction so the
366/// framework components (like object editor) can unreference it.
367
369{
370 if (el->fImpliedSelected > 0) {
371 for (auto slc : fSelectionList->fChildren) {
372 REveSelection *sel = dynamic_cast<REveSelection *>(slc);
373 sel->RemoveImpliedSelectedReferencesTo(el);
374 }
375
376 if (el->fImpliedSelected != 0)
377 Error("REveManager::PreDeleteElement", "ImpliedSelected not zero (%d) after cleanup of selections.",
378 el->fImpliedSelected);
379 }
380 // Primary selection deregistration is handled through Niece removal from Aunts.
381
382 if (el->fElementId != 0) {
383 auto it = fElementIdMap.find(el->fElementId);
384 if (it != fElementIdMap.end()) {
385 if (it->second == el) {
386 fElementIdMap.erase(it);
388 } else
389 Error("PreDeleteElement", "element ptr in ElementIdMap does not match the argument element.");
390 } else
391 Error("PreDeleteElement", "element id %u was not registered in ElementIdMap.", el->fElementId);
392 } else
393 Error("PreDeleteElement", "element with 0 ElementId passed in.");
394}
395
396////////////////////////////////////////////////////////////////////////////////
397/// Insert a new visualization-parameter database entry. Returns
398/// true if the element is inserted successfully.
399/// If entry with the same key already exists the behaviour depends on the
400/// 'replace' flag:
401/// - true - The old model is deleted and new one is inserted (default).
402/// Clients of the old model are transferred to the new one and
403/// if 'update' flag is true (default), the new model's parameters
404/// are assigned to all clients.
405/// - false - The old model is kept, false is returned.
406///
407/// If insert is successful, the ownership of the model-element is
408/// transferred to the manager.
409
411{
412 TPair *pair = (TPair *)fVizDB->FindObject(tag);
413 if (pair) {
414 if (replace) {
415 model->IncDenyDestroy();
416 model->SetRnrChildren(kFALSE);
417
418 REveElement *old_model = dynamic_cast<REveElement *>(pair->Value());
419 if (old_model) {
420 while (old_model->HasChildren()) {
421 REveElement *el = old_model->FirstChild();
422 el->SetVizModel(model);
423 if (update) {
424 el->CopyVizParams(model);
426 }
427 }
428 old_model->DecDenyDestroy();
429 }
430 pair->SetValue(dynamic_cast<TObject *>(model));
431 return kTRUE;
432 } else {
433 return kFALSE;
434 }
435 } else {
436 model->IncDenyDestroy();
437 model->SetRnrChildren(kFALSE);
438 fVizDB->Add(new TObjString(tag), dynamic_cast<TObject *>(model));
439 return kTRUE;
440 }
441}
442
443////////////////////////////////////////////////////////////////////////////////
444/// Insert a new visualization-parameter database entry with the default
445/// parameters for replace and update, as specified by members
446/// fVizDBReplace(default=kTRUE) and fVizDBUpdate(default=kTRUE).
447/// See docs of the above function.
448
450{
451 return InsertVizDBEntry(tag, model, fVizDBReplace, fVizDBUpdate);
452}
453
454////////////////////////////////////////////////////////////////////////////////
455/// Find a visualization-parameter database entry corresponding to tag.
456/// If the entry is not found 0 is returned.
457
459{
460 return dynamic_cast<REveElement *>(fVizDB->GetValue(tag));
461}
462
463////////////////////////////////////////////////////////////////////////////////
464/// Load visualization-parameter database from file filename. The
465/// replace, update arguments replace the values of fVizDBReplace
466/// and fVizDBUpdate members for the duration of the macro
467/// execution.
468
470{
471 Bool_t ex_replace = fVizDBReplace;
472 Bool_t ex_update = fVizDBUpdate;
473 fVizDBReplace = replace;
475
477
478 fVizDBReplace = ex_replace;
479 fVizDBUpdate = ex_update;
480}
481
482////////////////////////////////////////////////////////////////////////////////
483/// Load visualization-parameter database from file filename.
484/// State of data-members fVizDBReplace and fVizDBUpdate determine
485/// how the registered entries are handled.
486
488{
490 Redraw3D();
491}
492
493////////////////////////////////////////////////////////////////////////////////
494/// Save visualization-parameter database to file filename.
495
497{
498 TPMERegexp re("(.+)\\.\\w+");
499 if (re.Match(filename) != 2) {
500 Error("SaveVizDB", "filename does not match required format '(.+)\\.\\w+'.");
501 return;
502 }
503
504 TString exp_filename(filename);
505 gSystem->ExpandPathName(exp_filename);
506
507 std::ofstream out(exp_filename, std::ios::out | std::ios::trunc);
508 out << "void " << re[1] << "()\n";
509 out << "{\n";
510 out << " REveManager::Create();\n";
511
513
514 Int_t var_id = 0;
515 TString var_name;
516 TIter next(fVizDB);
517 TObjString *key;
518 while ((key = (TObjString *)next())) {
519 REveElement *mdl = dynamic_cast<REveElement *>(fVizDB->GetValue(key));
520 if (mdl) {
521 var_name.Form("x%03d", var_id++);
522 mdl->SaveVizParams(out, key->String(), var_name);
523 } else {
524 Warning("SaveVizDB", "Saving failed for key '%s'.", key->String().Data());
525 }
526 }
527
528 out << "}\n";
529 out.close();
530}
531
532////////////////////////////////////////////////////////////////////////////////
533/// Get geometry with given filename.
534/// This is cached internally so the second time this function is
535/// called with the same argument the same geo-manager is returned.
536/// gGeoManager is set to the return value.
537
539{
540 static const REveException eh("REveManager::GetGeometry ");
541
542 TString exp_filename = filename;
543 gSystem->ExpandPathName(exp_filename);
544 printf("REveManager::GetGeometry loading: '%s' -> '%s'.\n", filename.Data(), exp_filename.Data());
545
547 if (gGeoManager) {
549 } else {
550 Bool_t locked = TGeoManager::IsLocked();
551 if (locked) {
552 Warning("REveManager::GetGeometry", "TGeoManager is locked ... unlocking it.");
554 }
555 if (TGeoManager::Import(filename) == nullptr) {
556 throw eh + "TGeoManager::Import() failed for '" + exp_filename + "'.";
557 }
558 if (locked) {
560 }
561
563
564 // Import colors exported by Gled, if they exist.
565 {
566 TFile f(exp_filename, "READ");
567 TObjArray *collist = (TObjArray *)f.Get("ColorList");
568 f.Close();
569 if (collist) {
571 TGeoVolume *vol;
572 while ((vol = (TGeoVolume *)next()) != nullptr) {
573 Int_t oldID = vol->GetLineColor();
574 TColor *col = (TColor *)collist->At(oldID);
575 Float_t r, g, b;
576 col->GetRGB(r, g, b);
577 Int_t newID = TColor::GetColor(r, g, b);
578 vol->SetLineColor(newID);
579 }
580 }
581 }
582
584 }
585 return gGeoManager;
586}
587
588////////////////////////////////////////////////////////////////////////////////
589/// Get geometry with given alias.
590/// The alias must be registered via RegisterGeometryAlias().
591
593{
594 static const REveException eh("REveManager::GetGeometry ");
595
596 TObjString *full_name = (TObjString *)fGeometryAliases->GetValue(alias);
597 if (!full_name)
598 throw eh + "geometry alias '" + alias + "' not registered.";
599 return GetGeometry(full_name->String());
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Get the default geometry.
604/// It should be registered via RegisterGeometryName("Default", `<URL>`).
605
607{
608 return GetGeometryByAlias("Default");
609}
610
611////////////////////////////////////////////////////////////////////////////////
612/// Get the default viewer.
613///
614
616{
617 return dynamic_cast<REveViewer*>(fViewers->FirstChild());
618}
619
620////////////////////////////////////////////////////////////////////////////////
621/// Utility function to allow remote RWebWindow connections.
622/// Disable loopback when use remote client.
623/// Authentification key has to be disabled in the case of multiple connections.
624/// The default arguments prevent remote connections for the security reasons.
625//
626void REveManager::AllowMultipleRemoteConnections(bool loopBack, bool requireAuthKey)
627{
629 fWebWindow->SetRequireAuthKey(requireAuthKey);
630}
631
632////////////////////////////////////////////////////////////////////////////////
633/// Register 'name' as an alias for geometry file 'filename'.
634/// The old aliases are silently overwritten.
635/// After that the geometry can be retrieved also by calling:
636/// REX::gEve->GetGeometryByName(name);
637
639{
641}
642
643////////////////////////////////////////////////////////////////////////////////
644/// Work-around uber ugly hack used in SavePrimitive and co.
645
647{
648 gROOT->ResetClassSaved();
649}
650
651////////////////////////////////////////////////////////////////////////////////
652/// Register new directory to THttpServer
653// For example: AddLocation("mydir/", "/test/EveWebApp/ui5");
654//
655void REveManager::AddLocation(const std::string &locationName, const std::string &path)
656{
657 fWebWindow->GetServer()->AddLocation(locationName.c_str(), path.c_str());
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// Set content of default window HTML page
662// Got example: SetDefaultHtmlPage("file:currentdir/test.html")
663//
664void REveManager::SetDefaultHtmlPage(const std::string &path)
665{
666 fWebWindow->SetDefaultPage(path);
667}
668
669////////////////////////////////////////////////////////////////////////////////
670/// Set client version, used as prefix in scripts URL
671/// When changed, web browser will reload all related JS files while full URL will be different
672/// Default is empty value - no extra string in URL
673/// Version should be string like "1.2" or "ver1.subv2" and not contain any special symbols
674void REveManager::SetClientVersion(const std::string &version)
675{
676 fWebWindow->SetClientVersion(version);
677}
678
679////////////////////////////////////////////////////////////////////////////////
680/// If global REveManager* REX::gEve is not set initialize it.
681/// Returns REX::gEve.
682
684{
685 static const REveException eh("REveManager::Create ");
686
687 if (!REX::gEve) {
688 // XXXX Initialize some server stuff ???
689
690 REX::gEve = new REveManager();
691 }
692 return REX::gEve;
693}
694
695////////////////////////////////////////////////////////////////////////////////
696/// Properly terminate global REveManager.
697
699{
700 if (!REX::gEve)
701 return;
702
703 delete REX::gEve;
704 REX::gEve = nullptr;
705}
706
707void REveManager::ExecuteInMainThread(std::function<void()> func)
708{
709 class XThreadTimer : public TTimer {
710 std::function<void()> foo_;
711 public:
712 XThreadTimer(std::function<void()> f) : foo_(f)
713 {
714 SetTime(0);
716 gSystem->AddTimer(this);
717 }
718 Bool_t Notify() override
719 {
720 foo_();
721 gSystem->RemoveTimer(this);
722 delete this;
723 return kTRUE;
724 }
725 };
726
727 new XThreadTimer(func);
728}
729
731{
733 // QQQQ Should call Terminate() but it needs to:
734 // - properly stop MIRExecThread;
735 // - shutdown civet/THttp/RWebWindow
737 });
738}
739
740////////////////////////////////////////////////////////////////////////////////
741/// Process new connection from web window
742
743void REveManager::WindowConnect(unsigned connid)
744{
745 std::unique_lock<std::mutex> lock(fServerState.fMutex);
746
748 {
749 fServerState.fCV.wait(lock);
750 }
751
752 fConnList.emplace_back(connid);
753 printf("connection established %u\n", connid);
754
755 // QQQQ do we want mir-time here as well? maybe set it at the end of function?
756 // Note, this is all under lock, so nobody will get state out in between.
757 fServerStatus.fTLastMir = fServerStatus.fTLastConnect = std::time(nullptr);
759
760 // This prepares core and render data buffers.
761 printf("\nEVEMNG ............. streaming the world scene.\n");
762
763 fWorld->AddSubscriber(std::make_unique<REveClient>(connid, fWebWindow));
765
766 printf(" sending json, len = %d\n", (int)fWorld->fOutputJson.size());
767 Send(connid, fWorld->fOutputJson);
768 printf(" for now assume world-scene has no render data, binary-size=%d\n", fWorld->fTotalBinarySize);
769 assert(fWorld->fTotalBinarySize == 0);
770
771 for (auto &c : fScenes->RefChildren()) {
772 REveScene *scene = dynamic_cast<REveScene *>(c);
773 if (!scene->GetMandatory())
774 continue;
775
776 scene->AddSubscriber(std::make_unique<REveClient>(connid, fWebWindow));
777 printf("\nEVEMNG ............. streaming scene %s [%s]\n", scene->GetCTitle(), scene->GetCName());
778
779 // This prepares core and render data buffers.
780 scene->StreamElements();
781
782 printf(" sending json, len = %d\n", (int)scene->fOutputJson.size());
783 Send(connid, scene->fOutputJson);
784
785 if (scene->fTotalBinarySize > 0) {
786 printf(" sending binary, len = %d\n", scene->fTotalBinarySize);
787 SendBinary(connid, &scene->fOutputBinary[0], scene->fTotalBinarySize);
788 } else {
789 printf(" NOT sending binary, len = %d\n", scene->fTotalBinarySize);
790 }
791 }
792
793 fServerState.fCV.notify_all();
794}
795
796////////////////////////////////////////////////////////////////////////////////
797/// Process disconnect of web window
798
799void REveManager::WindowDisconnect(unsigned connid)
800{
801 std::unique_lock<std::mutex> lock(fServerState.fMutex);
802 auto conn = fConnList.end();
803 for (auto i = fConnList.begin(); i != fConnList.end(); ++i) {
804 if (i->fId == connid) {
805 conn = i;
806 break;
807 }
808 }
809 // this should not happen, just check
810 if (conn == fConnList.end()) {
811 printf("error, connection not found!");
812 } else {
813 printf("connection closed %u\n", connid);
814 fConnList.erase(conn);
815 for (auto &c : fScenes->RefChildren()) {
816 REveScene *scene = dynamic_cast<REveScene *>(c);
817 scene->RemoveSubscriber(connid);
818 }
819 fWorld->RemoveSubscriber(connid);
820 }
821
822 // User case: someone can close browser tab as clients are updateding
823 // note if scene changes are in progess the new serverstate will be changes after finish those
825 {
827 }
828
829 fServerStatus.fTLastDisconnect = std::time(nullptr);
831
832 fServerState.fCV.notify_all();
833}
834
835////////////////////////////////////////////////////////////////////////////////
836/// Process data from web window
837
838void REveManager::WindowData(unsigned connid, const std::string &arg)
839{
840 static const REveException eh("REveManager::WindowData ");
841
842 // find connection object
843 bool found = false;
844 for (auto &conn : fConnList) {
845 if (conn.fId == connid) {
846 found = true;
847 break;
848 }
849 }
850
851 // this should not happen, just check
852 if (!found) {
853 R__LOG_ERROR(REveLog()) << "Internal error - no connection with id " << connid << " found";
854 return;
855 }
856
857
858 if (arg.compare("__REveDoneChanges") == 0)
859 {
860 // client status data
861 std::unique_lock<std::mutex> lock(fServerState.fMutex);
862
863 for (auto &conn : fConnList) {
864 if (conn.fId == connid) {
865 conn.fState = Conn::Free;
866 break;
867 }
868 }
869
872 fServerState.fCV.notify_all();
873 }
874
875 return;
876 }
878 {
879 if (fHttpPublic)
880 {
881 R__LOG_INFO(REveLog()) << "REveManager::WindowData, file dialog is not allowed in restriced public mode";
882 }
883 else
884 {
886 }
887 return;
888 }
889 else if (arg.compare(0, 11, "SETCHANNEL:") == 0) {
890 std::string s = arg.substr(11);
891 auto p = s.find(",");
892 int eveid = std::stoi(s.substr(0, p));
893 int chid = std::stoi(s.substr(p+1));
894
895 REveElement* n = FindElementById(eveid);
896 auto nn = dynamic_cast<REveGeoTopNodeData*>(n);
897 if (nn) nn->SetChannel(connid, chid);
898
899 return;
900 }
901
902 nlohmann::json cj = nlohmann::json::parse(arg);
903 if (gDebug > 0)
904 ::Info("REveManager::WindowData", "MIR test %s\n", cj.dump().c_str());
905
906 std::string cmd = cj["mir"];
907 int id = cj["fElementId"];
908 std::string ctype = cj["class"];
909
910 ScheduleMIR(cmd, id, ctype, connid);
911}
912
913//
914//____________________________________________________________________
915void REveManager::ScheduleMIR(const std::string &cmd, ElementId_t id, const std::string& ctype, unsigned connid)
916{
917 std::unique_lock<std::mutex> lock(fServerState.fMutex);
918 fServerStatus.fTLastMir = std::time(nullptr);
919 fMIRqueue.push(std::make_shared<MIR>(cmd, id, ctype, connid));
920
921 if (fMIRqueue.size() > 5)
922 std::cout << "Warning, REveManager::ScheduleMIR(). queue size " << fMIRqueue.size() << std::endl;
923
925 fServerState.fCV.notify_all();
926}
927
928//
929//____________________________________________________________________
930void REveManager::ExecuteMIR(std::shared_ptr<MIR> mir)
931{
932 static const REveException eh(""); // Empty -- all errors go to R__LOG
933
934 //if (gDebug > 0)
935 ::Info("REveManager::ExecuteCommand", "MIR cmd %s", mir->fCmd.c_str());
936
937 std::string tag = mir->fCtype + "::<to-be-determined>";
938
939 try {
940 REveElement *el = FindElementById(mir->fId);
941 if ( ! el) throw eh + "Element with id " + mir->fId + " not found";
942
943 static const std::regex cmd_re("^(\\w[\\w\\d]*)\\(\\s*(.*)\\s*\\)\\s*;?\\s*$", std::regex::optimize);
944 std::smatch m;
945 std::regex_search(mir->fCmd, m, cmd_re);
946 if (m.size() != 3)
947 throw eh + "Command string parse error: '" + mir->fCmd + "'.";
948
949 static const TClass *elem_cls = TClass::GetClass<REX::REveElement>();
950
951 TClass *call_cls = TClass::GetClass(mir->fCtype.c_str());
952 if ( ! call_cls)
953 throw eh + "Class '" + mir->fCtype + "' not found.";
954
955 void *el_casted = call_cls->DynamicCast(elem_cls, el, false);
956 if ( ! el_casted)
957 throw eh + "Dynamic cast from REveElement to '" + mir->fCtype + "' failed.";
958
959 tag = mir->fCtype + "::" + m.str(1);
960
961 std::shared_ptr<TMethodCall> mc;
962 auto mmi = fMethCallMap.find(tag);
963 if (mmi != fMethCallMap.end())
964 {
965 mc = mmi->second;
966 }
967 else
968 {
969 const TMethod *meth = call_cls->GetMethodAllAny(m.str(1).c_str());
970 if ( ! meth)
971 throw eh + "Can not find TMethod matching '" + m.str(1) + "'.";
972 mc = std::make_shared<TMethodCall>(meth);
973 fMethCallMap.insert(std::make_pair(tag, mc));
974 }
975
977
979 mc->Execute(el_casted, m.str(2).c_str());
980
982 R__LOG_ERROR(REveLog()) << eh << "error executing " << tag << ":" << REveElement::stlMirErrorString << " (code " << REveElement::stlMirError << ").";
983 }
985
986 // Alternative implementation through Cling. "Leaks" 200 kB per call.
987 // This might be needed for function calls that involve data-types TMethodCall
988 // can not handle.
989 // std::stringstream cmd;
990 // cmd << "((" << mir->fCtype << "*)" << std::hex << std::showbase << (size_t)el << ")->" << mir->fCmd << ";";
991 // std::cout << cmd.str() << std::endl;
992 // gROOT->ProcessLine(cmd.str().c_str());
993 } catch (std::exception &e) {
994 R__LOG_ERROR(REveLog()) << "caught exception executing " << tag << ": " << e.what();
995 } catch (...) {
996 R__LOG_ERROR(REveLog()) << "caught unknown execption.";
997 }
998}
999
1000// Write scene change into scenes's internal json member
1002{
1004
1005 for (auto &el : fScenes->RefChildren())
1006 {
1007 REveScene* s = dynamic_cast<REveScene*>(el);
1009 }
1010}
1011
1012// Send json and binary data to scene's connections
1014{
1015 // send begin message
1016 nlohmann::json jobj = {};
1017 jobj["content"] = "BeginChanges";
1018 fWebWindow->Send(0, jobj.dump());
1019
1020 // send the change json
1022
1023 for (auto &el : fScenes->RefChildren())
1024 {
1025 REveScene* s = dynamic_cast<REveScene*>(el);
1027 }
1028
1029 // send end changes message and log messages
1030 jobj["content"] = "EndChanges";
1031
1032 if (!gEveLogEntries.empty()) {
1033 constexpr static int numLevels = static_cast<int>(ELogLevel::kDebug) + 1;
1034 constexpr static std::array<const char *, numLevels> sTag{
1035 {"{unset-error-level please report}", "FATAL", "Error", "Warning", "Info", "Debug"}};
1036
1037 jobj["log"] = nlohmann::json::array();
1038 std::stringstream strm;
1039 for (auto entry : gEveLogEntries) {
1040 strm.str("");
1041 nlohmann::json item = {};
1042 item["lvl"] = entry.fLevel;
1043 int cappedLevel = std::min(static_cast<int>(entry.fLevel), numLevels - 1);
1044 strm << "Server " << sTag[cappedLevel] << ":";
1045
1046 if (!entry.fLocation.fFuncName.empty())
1047 strm << " " << entry.fLocation.fFuncName;
1048 strm << " " << entry.fMessage;
1049 item["msg"] = strm.str();
1050 jobj["log"].push_back(item);
1051 }
1052 gEveLogEntries.clear();
1053 }
1054 fWebWindow->Send(0, jobj.dump());
1055}
1056
1057//
1058//____________________________________________________________________
1060{
1061#if defined(R__LINUX)
1062 pthread_setname_np(pthread_self(), "mir_exec");
1063#endif
1064 while (true)
1065 {
1066 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1067 underlock:
1069 {
1070 fServerState.fCV.wait(lock);
1071 goto underlock;
1072 }
1073 else
1074 {
1075 // set server state and update the queue under lock
1076 //
1078 std::shared_ptr<MIR> mir = fMIRqueue.front();
1079
1080 // reset local thread related data
1081 gMIRData.reset();
1082 fMIRqueue.pop();
1083
1084 lock.unlock();
1085
1086 // Ideally, as in gled, MIR execution would be steered by scenes themselves.
1087 // But this requires alpha/beta/gamma MIR elements and scene dependenices,
1088 // so dependent scenes can be locked, too.
1089 // On top of that, one could also implements authorization framework, as in gled.
1090
1093
1094 ExecuteMIR(mir);
1095
1098
1100
1101 // send changes (need to access client connection list) and set the state under lock
1102 //
1103 lock.lock();
1104
1105 // disconnect requested scene from clients
1106 for (auto &scene : gMIRData.removedWatch)
1107 scene->RemoveSubscriber(mir->fConnId);
1108
1109
1110 // connect and stream scenes to new clients
1111 for (auto &scene : gMIRData.addedWatch) {
1112 scene->AddSubscriber(std::make_unique<REveClient>(mir->fConnId, fWebWindow));
1113 scene->StreamElements();
1114 Send(mir->fConnId, scene->fOutputJson);
1115 if (scene->fTotalBinarySize > 0)
1116 SendBinary(mir->fConnId, &scene->fOutputBinary[0], scene->fTotalBinarySize);
1117 }
1118
1120
1122 fServerState.fCV.notify_all();
1123 }
1124 }
1125}
1126
1127//____________________________________________________________________
1129{
1130 for (auto &c : view->RefChildren()) {
1131 REveSceneInfo *sinfo = dynamic_cast<REveSceneInfo *>(c);
1132 std::cout << "Disconnect scee " << sinfo->GetScene()->GetName();
1133 gMIRData.removedWatch.push_back(sinfo->GetScene());
1134 }
1135}
1136//____________________________________________________________________
1138{
1139 view->StampObjProps();
1140 for (auto &c : view->RefChildren()) {
1141 REveSceneInfo *sinfo = dynamic_cast<REveSceneInfo *>(c);
1142 std::cout << "Connect scene " << sinfo->GetScene()->GetName();
1143 gMIRData.addedWatch.push_back(sinfo->GetScene());
1144 }
1145}
1146
1147//____________________________________________________________________
1148void REveManager::Send(unsigned connid, const std::string &data)
1149{
1150 fWebWindow->Send(connid, data);
1151}
1152
1153void REveManager::SendBinary(unsigned connid, const void *data, std::size_t len)
1154{
1155 fWebWindow->SendBinary(connid, data, len);
1156}
1157
1159{
1160 for (auto &conn : fConnList) {
1161 if (conn.fState != Conn::Free)
1162 return false;
1163 }
1164
1165 return true;
1166}
1167
1168// called from REveScene::SendChangesToSubscribers
1170{
1171 for (auto &conn : fConnList) {
1172 if (conn.fId == cinnId)
1173 {
1174 conn.fState = Conn::WaitingResponse;
1175 break;
1176 }
1177 }
1178}
1179
1180//////////////////////////////////////////////////////////////////
1181/// Show eve manager in specified browser.
1182
1183/// If rootrc variable WebEve.DisableShow is set, HTTP server will be
1184/// started and access URL printed on stdout.
1185
1187{
1188 if (gEnv->GetValue("WebEve.DisableShow", 0) != 0) {
1189 std::string url = fWebWindow->GetUrl(true);
1190 printf("EVE URL %s\n", url.c_str());
1191 } else {
1192 fWebWindow->Show(args);
1193 }
1194}
1195
1196
1197//____________________________________________________________________
1199{
1200 // set server state and tag scenes to begin accepting changees
1201 {
1202 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1204 fServerState.fCV.wait(lock);
1205 }
1207 }
1210}
1211
1212//____________________________________________________________________
1214{
1215 // tag scene to disable accepting chages, write the change json
1218
1220
1221 // set new server state under lock
1222 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1225 fServerState.fCV.notify_all();
1226}
1227
1228//____________________________________________________________________
1230{
1231 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1233#if defined(_MSC_VER)
1234 std::timespec_get(&fServerStatus.fTReport, TIME_UTC);
1235#else
1236 fServerStatus.fTReport = std::time_t(nullptr);
1237#endif
1238 st = fServerStatus;
1239}
1240
1241/** \class REveManager::ChangeGuard
1242\ingroup REve
1243RAII guard for locking Eve manager (ctor) and processing changes (dtor).
1244*/
1245
1246//////////////////////////////////////////////////////////////////////
1247//
1248// Helper struct to guard update mechanism
1249//
1251{
1252 gEve->BeginChange();
1253}
1254
1256{
1257 gEve->EndChange();
1258}
1259
1260// gInterpreter error handlder
1261void REveManager::ErrorHandler(Int_t level, Bool_t abort, const char * location, const char *msg)
1262{
1263 if (level >= kError)
1264 {
1266 entry.fMessage = msg;
1267 gEveLogEntries.emplace_back(entry);
1268 }
1269 ::DefaultErrorHandler(level, abort, location, msg);
1270}
1271
1272/** \class REveManager::RExceptionHandler
1273\ingroup REve
1274Exception handler for Eve exceptions.
1275*/
1276
1277////////////////////////////////////////////////////////////////////////////////
1278/// Handle exceptions deriving from REveException.
1279
1281{
1282 REveException *ex = dynamic_cast<REveException *>(&exc);
1283 if (ex) {
1284 Info("Handle", "Exception %s", ex->what());
1285 // REX::gEve->SetStatusLine(ex->Data());
1286 gSystem->Beep();
1287 return kSEHandled;
1288 }
1289 return kSEProceed;
1290}
1291
1292
1293////////////////////////////////////////////////////////////////////////////////
1294/// Utility to stream loggs to client.
1295/// Return false to supress further emission
1296
1298{
1299 gEveLogEntries.emplace_back(entry);
1300 return false;
1301}
1302
1303
1304////////////////////////////////////////////////////////////////////////////////
1305/// Restrict functionality for this server when open to public
1306
1308{
1309 R__LOG_INFO(REveLog()) << "Set public mode to " << x <<".";
1310 fHttpPublic = x;
1311}
thread_local MIR_TL_Data_t gMIRData
thread_local std::vector< RLogEntry > gEveLogEntries
#define R__LOG_ERROR(...)
Definition RLogger.hxx:362
#define R__LOG_INFO(...)
Definition RLogger.hxx:364
#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:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
@ 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
winID h TVirtualViewer3D TVirtualGLPainter p
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:406
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
R__EXTERN TVirtualMutex * gSystemMutex
Definition TSystem.h:244
R__EXTERN TSystem * gSystem
Definition TSystem.h:561
#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.
static thread_local int stlMirError
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.
static void SetMirContext(REveElement *el)
void IncDenyDestroy()
Increases the deny-destroy count of the element.
static thread_local std::string stlMirErrorString
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:43
void SetChannel(unsigned connid, int chid)
bool Emit(const RLogEntry &entry) override
Utility to stream loggs to client.
EStatus Handle(std::exception &exc) override
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.
void AllowMultipleRemoteConnections(bool loopBack=true, bool useAuthKey=true)
Utility function to allow remote RWebWindow connections.
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 SetHttpPublic(bool)
Restrict functionality for this server when open to public.
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.
REveViewer * GetDefaultViewer() const
Get the default viewer.
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 BeginAcceptingChanges()
Loop-wrapers over Scene children, element type checked on insertion.
void DestroyScenes()
Destroy all scenes and their contents.
void AddSubscriber(std::unique_ptr< REveClient > &&sub)
Definition REveScene.cxx:69
std::vector< char > fOutputBinary
!
Definition REveScene.hxx:76
void StreamRepresentationChanges()
Prepare data for sending element changes.
void RemoveSubscriber(unsigned int)
Definition REveScene.cxx:80
REveSelection Container for selected and highlighted elements.
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
Definition REveUtil.cxx:95
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,...
static void SetSingleConnMode(bool on=true)
Enable or disable single connection mode (default on) If enabled, one connection only with any web wi...
static void SetLoopbackMode(bool on=true)
Set loopback mode for THttpServer used for web widgets By default is on.
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:4984
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Definition TClass.cxx:4453
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:3037
The color creation and management class.
Definition TColor.h:21
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
Definition TColor.h:54
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:1920
static void SetColorThreshold(Float_t t)
This method specifies the color threshold used by GetColor to retrieve a color.
Definition TColor.cxx:1987
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 an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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:797
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:376
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2356
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:324
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition TSystem.cxx:1274
virtual int GetPid()
Get process id.
Definition TSystem.cxx:707
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Definition TSystem.cxx:471
virtual int GetProcInfo(ProcInfo_t *info) const
Returns cpu and memory used by this process into the ProcInfo_t structure.
Definition TSystem.cxx:2489
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
Definition TSystem.cxx:481
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
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:51
std::vector< REveScene * > removedWatch
std::vector< REveScene * > addedWatch
TMarker m
Definition textangle.C:8