Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 {
18  TFile::SetCacheFileDir(".");
19 
20  TGeoManager::Import("https://root.cern/files/cms.root");
21 
22  gGeoManager->DefaultColors();
23  gGeoManager->SetVisLevel(4);
24  gGeoManager->GetVolume("TRAK")->InvisibleAll();
25  gGeoManager->GetVolume("HVP2")->SetTransparency(20);
26  gGeoManager->GetVolume("HVEQ")->SetTransparency(20);
27  gGeoManager->GetVolume("YE4")->SetTransparency(10);
28  gGeoManager->GetVolume("YE3")->SetTransparency(20);
29  gGeoManager->GetVolume("RB2")->SetTransparency(99);
30  gGeoManager->GetVolume("RB3")->SetTransparency(99);
31  gGeoManager->GetVolume("COCF")->SetTransparency(99);
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 }