Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
web_cms.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_webgui
3/// Web-based geometry viewer for CMS geometry
4///
5/// \macro_code
6///
7/// \author Sergey Linev
8
10
11#include "TGeoManager.h"
12#include "TGeoVolume.h"
13#include "TFile.h"
14
15void web_cms(bool split = false)
16{
18
19 TGeoManager::Import("https://root.cern/files/cms.root");
20
37
38 auto viewer = std::make_shared<ROOT::RGeomViewer>(gGeoManager);
39
40 // select volume to draw
41 viewer->SelectVolume("CMSE");
42
43 // specify JSROOT draw options - here clipping on X,Y,Z axes
44 viewer->SetDrawOptions("clipxyz");
45
46 // set default limits for number of visible nodes and faces
47 // when viewer created, initial values exported from TGeoManager
48 viewer->SetLimits();
49
50 viewer->SetShowHierarchy(!split);
51
52 // start web browser
53 viewer->Show();
54
55 // destroy viewer only when connection to client is closed
56 viewer->ClearOnClose(viewer);
57
58 if (split) {
59 // create separate widget with geometry hierarchy only
60 auto hier = std::make_shared<ROOT::RGeomHierarchy>(viewer->Description());
61
62 // start web browser with hierarchy
63 hier->Show();
64
65 // destroy widget only when connection to client is closed
66 hier->ClearOnClose(hier);
67 }
68
69}
R__EXTERN TGeoManager * gGeoManager
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Definition TFile.h:332
void SetVisLevel(Int_t level=3)
set default level down to which visualization is performed
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
static function Import a geometry from a gdml or ROOT file
TGeoVolume * GetVolume(const char *name) const
Search for a named volume. All trailing blanks stripped.
void DefaultColors()
Set default volume colors according to A of material.
void SetTransparency(Char_t transparency=0)
Definition TGeoVolume.h:376
void InvisibleAll(Bool_t flag=kTRUE)
Make volume and each of it daughters (in)visible.
void SetLineColor(Color_t lcolor) override
Set the line color.