Logo ROOT  
Reference Guide
projection.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstrates usage of automatic 2D projections - class TEveProjectionManager.
4///
5/// \image html eve_projection.png
6/// \macro_code
7///
8/// \author Matevz Tadel
9
10const char* esd_geom_file_name =
11 "http://root.cern.ch/files/alice_ESDgeometry.root";
12
13void projection()
14{
17
18 // camera
19 auto s = gEve->SpawnNewScene("Projected Event");
21 auto v = gEve->GetDefaultGLViewer();
22 v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
23 TGLOrthoCamera& cam = (TGLOrthoCamera&) v->CurrentCamera();
24 cam.SetZoomMinMax(0.2, 20);
25
26 // projections
28 s->AddElement(mng);
29 auto axes = new TEveProjectionAxes(mng);
30 axes->SetTitle("TEveProjections demo");
31 s->AddElement(axes);
32 gEve->AddToListTree(axes, kTRUE);
34
35 // Simple geometry
36 auto geom = TFile::Open(esd_geom_file_name, "CACHEREAD");
37 if (!geom)
38 return;
39
40 auto gse = (TEveGeoShapeExtract*) geom->Get("Gentle");
41 auto gsre = TEveGeoShape::ImportShapeExtract(gse, 0);
42 geom->Close();
43 delete geom;
44 gsre->SetPickableRecursively(kTRUE);
47 mng->ImportElements(gsre);
48
49 auto line = new TEveLine;
50 line->SetMainColor(kGreen);
51 for (Int_t i=0; i<160; ++i)
52 line->SetNextPoint(120*sin(0.2*i), 120*cos(0.2*i), 80-i);
54 mng->ImportElements(line);
55 line->SetRnrSelf(kFALSE);
56
58}
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
const Bool_t kTRUE
Definition: RtypesCore.h:89
@ kGreen
Definition: Rtypes.h:64
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
double cos(double)
double sin(double)
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
Globally positioned TGeoShape with rendering attributes and an optional list of daughter shape-extrac...
static TEveGeoShape * ImportShapeExtract(TEveGeoShapeExtract *gse, TEveElement *parent=0)
Import a shape extract 'gse' under element 'parent'.
An arbitrary polyline with fixed line and marker attributes.
Definition: TEveLine.h:26
void AddElement(TEveElement *element, TEveElement *parent=0)
Add an element.
void AddGlobalElement(TEveElement *element, TEveElement *parent=0)
Add a global element, i.e.
TGLViewer * GetDefaultGLViewer() const
Get TGLViewer of the default TEveViewer.
TEveViewer * GetDefaultViewer() const
Returns the default viewer - the first one in the fViewers list.
TEveScene * GetGlobalScene() const
Definition: TEveManager.h:147
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
Axes for non-linear projections.
Manager class for steering of projections and managing projected objects.
virtual void AddScene(TEveScene *scene)
Add 'scene' to the list of scenes.
Definition: TEveViewer.cxx:262
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Definition: TFile.h:323
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:3942
Orthographic projection camera.
void SetZoomMinMax(Double_t min, Double_t max)
@ kCameraOrthoXOY
Definition: TGLViewer.h:64
TLine * line
static constexpr double s