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