Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
show_extract.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve7
3/// Helper script for showing of extracted / simplified geometries.
4/// By default shows a simplified ALICE geometry.
5///
6/// \image html eve_show_extract.png
7/// \macro_code
8///
9/// \author Matevz Tadel
10
11#include "TFile.h"
12#include "TKey.h"
13
14#include "TGeoShape.h"
15
16#include <ROOT/REveManager.hxx>
18#include <ROOT/REveGeoShape.hxx>
19
20namespace REX = ROOT::Experimental;
21
22void show_extract(const char* file="csg.root")
23{
24 // disable browser cache - all scripts and html files will be loaded every time, useful for development
25 // gEnv->SetValue("WebGui.HttpMaxAge", 0);
26
27 auto eveMng = REX::REveManager::Create();
28
30
31 TIter next(gDirectory->GetListOfKeys());
32
33 const TString extract_class("ROOT::Experimental::REveGeoShapeExtract");
34
35 REX::REveGeoShape *eve_shape = nullptr;
36
37 while (auto key = (TKey *)next())
38 {
39 if (extract_class == key->GetClassName())
40 {
41 auto gse = (REX::REveGeoShapeExtract*) key->ReadObj();
42 eve_shape = REX::REveGeoShape::ImportShapeExtract(gse, 0);
43 eveMng->AddGlobalElement(eve_shape);
44 }
45 }
46
47 if (!eve_shape)
48 {
49 Error("show_extract.C", "No keys of class '%s'.", extract_class.Data());
50 return;
51 }
52
53 eve_shape->GetShape()->Draw("ogl");
54}
#define gDirectory
Definition TDirectory.h:290
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
void AddGlobalElement(REveElement *element, REveElement *parent=nullptr)
Add a global element, i.e.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:3997
virtual void Draw(Option_t *option="")
Draw this shape.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
Basic string class.
Definition TString.h:136
ROOT::Experimental::REveManager * eveMng
Definition file.py:1