Logo ROOT   6.19/01
Reference Guide
viewer.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_eve7
3 /// Web-based geometry viewer for CMS geometry
4 ///
5 /// \macro_code
6 ///
7 /// \author Sergey Linev
8 
10 #include <ROOT/RDirectory.hxx>
11 
12 #include "TGeoManager.h"
13 #include "TGeoVolume.h"
14 #include "TFile.h"
15 
16 void viewer()
17 {
19 
20  TGeoManager::Import("https://root.cern/files/cms.root");
21 
32  gGeoManager->GetVolume("HEC1")->SetLineColor(7);
33  gGeoManager->GetVolume("EAP1")->SetLineColor(7);
34  gGeoManager->GetVolume("EAP2")->SetLineColor(7);
35  gGeoManager->GetVolume("EAP3")->SetLineColor(7);
36  gGeoManager->GetVolume("EAP4")->SetLineColor(7);
37  gGeoManager->GetVolume("HTC1")->SetLineColor(2);
38 
39  using namespace ROOT::Experimental;
40 
41  auto viewer = std::make_shared<REveGeomViewer>(gGeoManager);
42 
43  // select volume to draw
44  viewer->SelectVolume("CMSE");
45 
46  // specify JSROOT draw options - here clipping on X,Y,Z axes
47  viewer->SetDrawOptions("clipxyz");
48 
49  // set default limits for number of visible nodes and faces
50  // when viewer created, initial values exported from TGeoManager
51  viewer->SetLimits();
52 
53  // start browser
54  viewer->Show();
55 
56  // add to global heap to avoid immediate destroy of RGeomViewer
57  RDirectory::Heap().Add("geom_viewer", viewer);
58 }
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Definition: TFile.h:319
TGeoVolume * GetVolume(const char *name) const
Search for a named volume. All trailing blanks stripped.
static RDirectory & Heap()
Dedicated, process-wide RDirectory.
Definition: RFile.cxx:23
void InvisibleAll(Bool_t flag=kTRUE)
Make volume and each of it daughters (in)visible.
Definition: TGeoVolume.cxx:763
void DefaultColors()
Set default volume colors according to A of material.
void SetTransparency(Char_t transparency=0)
Definition: TGeoVolume.h:215
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:601
virtual void SetLineColor(Color_t lcolor)
Set the line color.
void Add(std::string_view name, const std::shared_ptr< T > &ptr)
Add an existing object (rather a shared_ptr to it) to the RDirectory.
Definition: RDirectory.hxx:172
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