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 gROOT->ResetClassSaved();
642}
643
644////////////////////////////////////////////////////////////////////////////////
645/// Register new directory to THttpServer
646// For example: AddLocation("mydir/", "/test/EveWebApp/ui5");
647//
648void REveManager::AddLocation(const std::string &locationName, const std::string &path)
649{
650 fWebWindow->GetServer()->AddLocation(locationName.c_str(), path.c_str());
651}
652
653////////////////////////////////////////////////////////////////////////////////
654/// Set content of default window HTML page
655// Got example: SetDefaultHtmlPage("file:currentdir/test.html")
656//
657void REveManager::SetDefaultHtmlPage(const std::string &path)
658{
659 fWebWindow->SetDefaultPage(path);
660}
661
662////////////////////////////////////////////////////////////////////////////////
663/// Set client version, used as prefix in scripts URL
664/// When changed, web browser will reload all related JS files while full URL will be different
665/// Default is empty value - no extra string in URL
666/// Version should be string like "1.2" or "ver1.subv2" and not contain any special symbols
667void REveManager::SetClientVersion(const std::string &version)
668{
669 fWebWindow->SetClientVersion(version);
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// If global REveManager* REX::gEve is not set initialize it.
674/// Returns REX::gEve.
675
677{
678 static const REveException eh("REveManager::Create ");
679
680 if (!REX::gEve) {
681 // XXXX Initialize some server stuff ???
682
683 REX::gEve = new REveManager();
684 }
685 return REX::gEve;
686}
687
688////////////////////////////////////////////////////////////////////////////////
689/// Properly terminate global REveManager.
690
692{
693 if (!REX::gEve)
694 return;
695
696 delete REX::gEve;
697 REX::gEve = nullptr;
698}
699
700void REveManager::ExecuteInMainThread(std::function<void()> func)
701{
702 class XThreadTimer : public TTimer {
703 std::function<void()> foo_;
704 public:
705 XThreadTimer(std::function<void()> f) : foo_(f)
706 {
707 SetTime(0);
709 gSystem->AddTimer(this);
710 }
711 Bool_t Notify() override
712 {
713 foo_();
714 gSystem->RemoveTimer(this);
715 delete this;
716 return kTRUE;
717 }
718 };
719
720 new XThreadTimer(func);
721}
722
724{
726 // QQQQ Should call Terminate() but it needs to:
727 // - properly stop MIRExecThread;
728 // - shutdown civet/THttp/RWebWindow
730 });
731}
732
733////////////////////////////////////////////////////////////////////////////////
734/// Process new connection from web window
735
736void REveManager::WindowConnect(unsigned connid)
737{
738 std::unique_lock<std::mutex> lock(fServerState.fMutex);
739
741 {
742 fServerState.fCV.wait(lock);
743 }
744
745 fConnList.emplace_back(connid);
746 printf("connection established %u\n", connid);
747
748 // QQQQ do we want mir-time here as well? maybe set it at the end of function?
749 // Note, this is all under lock, so nobody will get state out in between.
750 fServerStatus.fTLastMir = fServerStatus.fTLastConnect = std::time(nullptr);
752
753 // This prepares core and render data buffers.
754 printf("\nEVEMNG ............. streaming the world scene.\n");
755
756 fWorld->AddSubscriber(std::make_unique<REveClient>(connid, fWebWindow));
758
759 printf(" sending json, len = %d\n", (int)fWorld->fOutputJson.size());
760 Send(connid, fWorld->fOutputJson);
761 printf(" for now assume world-scene has no render data, binary-size=%d\n", fWorld->fTotalBinarySize);
762 assert(fWorld->fTotalBinarySize == 0);
763
764 for (auto &c : fScenes->RefChildren()) {
765 REveScene *scene = dynamic_cast<REveScene *>(c);
766 if (!scene->GetMandatory())
767 continue;
768
769 scene->AddSubscriber(std::make_unique<REveClient>(connid, fWebWindow));
770 printf("\nEVEMNG ............. streaming scene %s [%s]\n", scene->GetCTitle(), scene->GetCName());
771
772 // This prepares core and render data buffers.
773 scene->StreamElements();
774
775 printf(" sending json, len = %d\n", (int)scene->fOutputJson.size());
776 Send(connid, scene->fOutputJson);
777
778 if (scene->fTotalBinarySize > 0) {
779 printf(" sending binary, len = %d\n", scene->fTotalBinarySize);
780 SendBinary(connid, &scene->fOutputBinary[0], scene->fTotalBinarySize);
781 } else {
782 printf(" NOT sending binary, len = %d\n", scene->fTotalBinarySize);
783 }
784 }
785
786 fServerState.fCV.notify_all();
787}
788
789////////////////////////////////////////////////////////////////////////////////
790/// Process disconnect of web window
791
792void REveManager::WindowDisconnect(unsigned connid)
793{
794 std::unique_lock<std::mutex> lock(fServerState.fMutex);
795 auto conn = fConnList.end();
796 for (auto i = fConnList.begin(); i != fConnList.end(); ++i) {
797 if (i->fId == connid) {
798 conn = i;
799 break;
800 }
801 }
802 // this should not happen, just check
803 if (conn == fConnList.end()) {
804 printf("error, connection not found!");
805 } else {
806 printf("connection closed %u\n", connid);
807 fConnList.erase(conn);
808 for (auto &c : fScenes->RefChildren()) {
809 REveScene *scene = dynamic_cast<REveScene *>(c);
810 scene->RemoveSubscriber(connid);
811 }
812 fWorld->RemoveSubscriber(connid);
813 }
814
815 // User case: someone can close browser tab as clients are updateding
816 // note if scene changes are in progess the new serverstate will be changes after finish those
818 {
820 }
821
822 fServerStatus.fTLastDisconnect = std::time(nullptr);
824
825 fServerState.fCV.notify_all();
826}
827
828////////////////////////////////////////////////////////////////////////////////
829/// Process data from web window
830
831void REveManager::WindowData(unsigned connid, const std::string &arg)
832{
833 static const REveException eh("REveManager::WindowData ");
834
835 // find connection object
836 bool found = false;
837 for (auto &conn : fConnList) {
838 if (conn.fId == connid) {
839 found = true;
840 break;
841 }
842 }
843
844 // this should not happen, just check
845 if (!found) {
846 R__LOG_ERROR(REveLog()) << "Internal error - no connection with id " << connid << " found";
847 return;
848 }
849
850
851 if (arg.compare("__REveDoneChanges") == 0)
852 {
853 // client status data
854 std::unique_lock<std::mutex> lock(fServerState.fMutex);
855
856 for (auto &conn : fConnList) {
857 if (conn.fId == connid) {
858 conn.fState = Conn::Free;
859 break;
860 }
861 }
862
865 fServerState.fCV.notify_all();
866 }
867
868 return;
869 }
871 {
872 // file dialog
874 return;
875 }
876
877 nlohmann::json cj = nlohmann::json::parse(arg);
878 if (gDebug > 0)
879 ::Info("REveManager::WindowData", "MIR test %s\n", cj.dump().c_str());
880
881 std::string cmd = cj["mir"];
882 int id = cj["fElementId"];
883 std::string ctype = cj["class"];
884
885 ScheduleMIR(cmd, id, ctype, connid);
886}
887
888//
889//____________________________________________________________________
890void REveManager::ScheduleMIR(const std::string &cmd, ElementId_t id, const std::string& ctype, unsigned connid)
891{
892 std::unique_lock<std::mutex> lock(fServerState.fMutex);
893 fServerStatus.fTLastMir = std::time(nullptr);
894 fMIRqueue.push(std::make_shared<MIR>(cmd, id, ctype, connid));
895
896 if (fMIRqueue.size() > 5)
897 std::cout << "Warning, REveManager::ScheduleMIR(). queue size " << fMIRqueue.size() << std::endl;
898
900 fServerState.fCV.notify_all();
901}
902
903//
904//____________________________________________________________________
905void REveManager::ExecuteMIR(std::shared_ptr<MIR> mir)
906{
907 static const REveException eh("REveManager::ExecuteMIR ");
908
909 //if (gDebug > 0)
910 ::Info("REveManager::ExecuteCommand", "MIR cmd %s", mir->fCmd.c_str());
911
912 try {
913 REveElement *el = FindElementById(mir->fId);
914 if ( ! el) throw eh + "Element with id " + mir->fId + " not found";
915
916 static const std::regex cmd_re("^(\\w[\\w\\d]*)\\(\\s*(.*)\\s*\\)\\s*;?\\s*$", std::regex::optimize);
917 std::smatch m;
918 std::regex_search(mir->fCmd, m, cmd_re);
919 if (m.size() != 3)
920 throw eh + "Command string parse error: '" + mir->fCmd + "'.";
921
922 static const TClass *elem_cls = TClass::GetClass<REX::REveElement>();
923
924 TClass *call_cls = TClass::GetClass(mir->fCtype.c_str());
925 if ( ! call_cls)
926 throw eh + "Class '" + mir->fCtype + "' not found.";
927
928 void *el_casted = call_cls->DynamicCast(elem_cls, el, false);
929 if ( ! el_casted)
930 throw eh + "Dynamic cast from REveElement to '" + mir->fCtype + "' failed.";
931
932 std::string tag(mir->fCtype + "::" + m.str(1));
933 std::shared_ptr<TMethodCall> mc;
934
935 auto mmi = fMethCallMap.find(tag);
936 if (mmi != fMethCallMap.end())
937 {
938 mc = mmi->second;
939 }
940 else
941 {
942 const TMethod *meth = call_cls->GetMethodAllAny(m.str(1).c_str());
943 if ( ! meth)
944 throw eh + "Can not find TMethod matching '" + m.str(1) + "'.";
945 mc = std::make_shared<TMethodCall>(meth);
946 fMethCallMap.insert(std::make_pair(tag, mc));
947 }
948
950 mc->Execute(el_casted, m.str(2).c_str());
951
952 // Alternative implementation through Cling. "Leaks" 200 kB per call.
953 // This might be needed for function calls that involve data-types TMethodCall
954 // can not handle.
955 // std::stringstream cmd;
956 // cmd << "((" << mir->fCtype << "*)" << std::hex << std::showbase << (size_t)el << ")->" << mir->fCmd << ";";
957 // std::cout << cmd.str() << std::endl;
958 // gROOT->ProcessLine(cmd.str().c_str());
959 } catch (std::exception &e) {
960 R__LOG_ERROR(REveLog()) << "REveManager::ExecuteCommand " << e.what() << std::endl;
961 } catch (...) {
962 R__LOG_ERROR(REveLog()) << "REveManager::ExecuteCommand unknow execption \n";
963 }
964}
965
966// Write scene change into scenes's internal json member
968{
970
971 for (auto &el : fScenes->RefChildren())
972 {
973 REveScene* s = dynamic_cast<REveScene*>(el);
975 }
976}
977
978// Send json and binary data to scene's connections
980{
981 // send begin message
982 nlohmann::json jobj = {};
983 jobj["content"] = "BeginChanges";
984 fWebWindow->Send(0, jobj.dump());
985
986 // send the change json
988
989 for (auto &el : fScenes->RefChildren())
990 {
991 REveScene* s = dynamic_cast<REveScene*>(el);
993 }
994
995 // send end changes message and log messages
996 jobj["content"] = "EndChanges";
997
998 if (!gEveLogEntries.empty()) {
999 constexpr static int numLevels = static_cast<int>(ELogLevel::kDebug) + 1;
1000 constexpr static std::array<const char *, numLevels> sTag{
1001 {"{unset-error-level please report}", "FATAL", "Error", "Warning", "Info", "Debug"}};
1002
1003 jobj["log"] = nlohmann::json::array();
1004 std::stringstream strm;
1005 for (auto entry : gEveLogEntries) {
1006 nlohmann::json item = {};
1007 item["lvl"] = entry.fLevel;
1008 int cappedLevel = std::min(static_cast<int>(entry.fLevel), numLevels - 1);
1009 strm << "Server " << sTag[cappedLevel] << ":";
1010
1011 if (!entry.fLocation.fFuncName.empty())
1012 strm << " " << entry.fLocation.fFuncName;
1013 strm << " " << entry.fMessage;
1014 item["msg"] = strm.str();
1015 jobj["log"].push_back(item);
1016 strm.clear();
1017 }
1018 gEveLogEntries.clear();
1019 }
1020
1021 fWebWindow->Send(0, jobj.dump());
1022}
1023
1024//
1025//____________________________________________________________________
1027{
1028#if defined(R__LINUX)
1029 pthread_setname_np(pthread_self(), "mir_exec");
1030#endif
1031 while (true)
1032 {
1033 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1034 underlock:
1036 {
1037 fServerState.fCV.wait(lock);
1038 goto underlock;
1039 }
1040 else
1041 {
1042 // set server state and update the queue under lock
1043 //
1045 std::shared_ptr<MIR> mir = fMIRqueue.front();
1046
1047 // reset local thread related data
1048 gMIRData.reset();
1049 fMIRqueue.pop();
1050
1051 lock.unlock();
1052
1053 // Ideally, as in gled, MIR execution would be steered by scenes themselves.
1054 // But this requires alpha/beta/gamma MIR elements and scene dependenices,
1055 // so dependent scenes can be locked, too.
1056 // On top of that, one could also implements authorization framework, as in gled.
1057
1060
1061 ExecuteMIR(mir);
1062
1065
1067
1068 // send changes (need to access client connection list) and set the state under lock
1069 //
1070 lock.lock();
1071
1072 // disconnect requested scene from clients
1073 for (auto &scene : gMIRData.removedWatch)
1074 scene->RemoveSubscriber(mir->fConnId);
1075
1076
1077 // connect and stream scenes to new clients
1078 for (auto &scene : gMIRData.addedWatch) {
1079 scene->AddSubscriber(std::make_unique<REveClient>(mir->fConnId, fWebWindow));
1080 scene->StreamElements();
1081 Send(mir->fConnId, scene->fOutputJson);
1082 if (scene->fTotalBinarySize > 0)
1083 SendBinary(mir->fConnId, &scene->fOutputBinary[0], scene->fTotalBinarySize);
1084 }
1085
1087
1089 fServerState.fCV.notify_all();
1090 }
1091 }
1092}
1093
1094//____________________________________________________________________
1096{
1097 for (auto &c : view->RefChildren()) {
1098 REveSceneInfo *sinfo = dynamic_cast<REveSceneInfo *>(c);
1099 std::cout << "Disconnect scee " << sinfo->GetScene()->GetName();
1100 gMIRData.removedWatch.push_back(sinfo->GetScene());
1101 }
1102}
1103//____________________________________________________________________
1105{
1106 view->StampObjProps();
1107 for (auto &c : view->RefChildren()) {
1108 REveSceneInfo *sinfo = dynamic_cast<REveSceneInfo *>(c);
1109 std::cout << "Connect scene " << sinfo->GetScene()->GetName();
1110 gMIRData.addedWatch.push_back(sinfo->GetScene());
1111 }
1112}
1113
1114//____________________________________________________________________
1115void REveManager::Send(unsigned connid, const std::string &data)
1116{
1117 fWebWindow->Send(connid, data);
1118}
1119
1120void REveManager::SendBinary(unsigned connid, const void *data, std::size_t len)
1121{
1122 fWebWindow->SendBinary(connid, data, len);
1123}
1124
1126{
1127 for (auto &conn : fConnList) {
1128 if (conn.fState != Conn::Free)
1129 return false;
1130 }
1131
1132 return true;
1133}
1134
1135// called from REveScene::SendChangesToSubscribers
1137{
1138 for (auto &conn : fConnList) {
1139 if (conn.fId == cinnId)
1140 {
1141 conn.fState = Conn::WaitingResponse;
1142 break;
1143 }
1144 }
1145}
1146
1147//////////////////////////////////////////////////////////////////
1148/// Show eve manager in specified browser.
1149
1150/// If rootrc variable WebEve.DisableShow is set, HTTP server will be
1151/// started and access URL printed on stdout.
1152
1154{
1155 if (gEnv->GetValue("WebEve.DisableShow", 0) != 0) {
1156 std::string url = fWebWindow->GetUrl(true);
1157 printf("EVE URL %s\n", url.c_str());
1158 } else {
1159 fWebWindow->Show(args);
1160 }
1161}
1162
1163
1164//____________________________________________________________________
1166{
1167 // set server state and tag scenes to begin accepting changees
1168 {
1169 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1171 fServerState.fCV.wait(lock);
1172 }
1174 }
1177}
1178
1179//____________________________________________________________________
1181{
1182 // tag scene to disable accepting chages, write the change json
1185
1187
1188 // set new server state under lock
1189 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1192 fServerState.fCV.notify_all();
1193}
1194
1195//____________________________________________________________________
1197{
1198 std::unique_lock<std::mutex> lock(fServerState.fMutex);
1200#if defined(_MSC_VER)
1201 std::timespec_get(&fServerStatus.fTReport, TIME_UTC);
1202#else
1203 fServerStatus.fTReport = std::time_t(nullptr);
1204#endif
1205 st = fServerStatus;
1206}
1207
1208/** \class REveManager::ChangeGuard
1209\ingroup REve
1210RAII guard for locking Eve manager (ctor) and processing changes (dtor).
1211*/
1212
1213//////////////////////////////////////////////////////////////////////
1214//
1215// Helper struct to guard update mechanism
1216//
1218{
1219 gEve->BeginChange();
1220}
1221
1223{
1224 gEve->EndChange();
1225}
1226
1227// Error handler streams error-level messages to client log
1228void REveManager::ErrorHandler(Int_t level, Bool_t abort, const char * location, const char *msg)
1229{
1230 if (level >= kError)
1231 {
1233 entry.fMessage = msg;
1234 gEveLogEntries.emplace_back(entry);
1235 }
1236 ::DefaultErrorHandler(level, abort, location, msg);
1237}
1238
1239/** \class REveManager::RExceptionHandler
1240\ingroup REve
1241Exception handler for Eve exceptions.
1242*/
1243
1244////////////////////////////////////////////////////////////////////////////////
1245/// Handle exceptions deriving from REveException.
1246
1248{
1249 REveException *ex = dynamic_cast<REveException *>(&exc);
1250 if (ex) {
1251 Info("Handle", "Exception %s", ex->what());
1252 // REX::gEve->SetStatusLine(ex->Data());
1253 gSystem->Beep();
1254 return kSEHandled;
1255 }
1256 return kSEProceed;
1257}
1258
1259
1260////////////////////////////////////////////////////////////////////////////////
1261/// Utility to stream loggs to client.
1262
1264{
1265 gEveLogEntries.emplace_back(entry);
1266 return true;
1267}
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: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
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: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: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 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: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
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
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 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