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