Logo ROOT   6.07/09
Reference Guide
projection.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_eve
3 /// Demonstates usage of automatic 2D projections - class TEveProjectionManager.
4 ///
5 /// \image html eve_projection.png
6 /// \macro_code
7 ///
8 /// \author Matevz Tadel
9 
10 const char* esd_geom_file_name =
11  "http://root.cern.ch/files/alice_ESDgeometry.root";
12 
13 void projection()
14 {
17 
18  // camera
19  TEveScene* s = gEve->SpawnNewScene("Projected Event");
24  cam.SetZoomMinMax(0.2, 20);
25 
26  // projections
29  s->AddElement(mng);
30  TEveProjectionAxes* axes = new TEveProjectionAxes(mng);
31  axes->SetTitle("TEveProjections demo");
32  s->AddElement(axes);
33  gEve->AddToListTree(axes, kTRUE);
34  gEve->AddToListTree(mng, kTRUE);
35 
36  // Simple geometry
37  TFile* geom = TFile::Open(esd_geom_file_name, "CACHEREAD");
38  if (!geom)
39  return;
40 
41  TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) geom->Get("Gentle");
43  geom->Close();
44  delete geom;
46  gEve->AddGlobalElement(gsre);
48  mng->ImportElements(gsre);
49 
50  TEveLine* line = new TEveLine;
51  line->SetMainColor(kGreen);
52  for (Int_t i=0; i<160; ++i)
53  line->SetNextPoint(120*sin(0.2*i), 120*cos(0.2*i), 80-i);
54  gEve->AddElement(line);
55  mng->ImportElements(line);
56  line->SetRnrSelf(kFALSE);
57 
59 }
Globally positioned TGeoShape with rendering attributes and an optional list of daughter shape-extrac...
Eve representation of TGLScene.
Definition: TEveScene.h:26
TLine * line
An arbitrary polyline with fixed line and marker attributes.
Definition: TEveLine.h:24
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:50
void AddGlobalElement(TEveElement *element, TEveElement *parent=0)
Add a global element, i.e.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: Rtypes.h:92
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
Definition: Rtypes.h:61
Axes for non-linear projections.
double cos(double)
void AddElement(TEveElement *element, TEveElement *parent=0)
Add an element.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3871
virtual TEveElement * ImportElements(TEveElement *el, TEveElement *ext_list=0)
Recursively import elements and apply projection to the newly imported objects.
TEveScene * GetGlobalScene() const
Definition: TEveManager.h:147
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
double sin(double)
Manager class for steering of projections and managing projected objects.
void SetZoomMinMax(Double_t min, Double_t max)
void SetPickableRecursively(Bool_t p)
Set pickable state on the element and all its children.
TEveViewer * GetDefaultViewer() const
Returns the default viewer - the first one in the fViewers list.
SVector< double, 2 > v
Definition: Dict.h:5
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
TGLCamera & CurrentCamera() const
Definition: TGLViewer.h:267
virtual Bool_t SetRnrSelf(Bool_t rnr)
Set render state of this element, i.e.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:53
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual void SetMainColor(Color_t color)
Set main color of the element.
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
Set point following LastPoint to x, y, z.
TGLViewer * GetDefaultGLViewer() const
Get TGLViewer of the default TEveViewer.
void SetCurrentCamera(ECameraType camera)
Set current active camera - &#39;cameraType&#39; one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ, kCameraOrthoXOY, kCameraOrthoXOZ, kCameraOrthoZOY, kCameraOrthoXnOY, kCameraOrthoXnOZ, kCameraOrthoZnOY.
Definition: TGLViewer.cxx:1786
Orthographic projection camera.
static Bool_t SetCacheFileDir(const char *cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
Definition: TFile.cxx:4391
Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted TG...
Definition: TEveGeoShape.h:23
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
const Bool_t kTRUE
Definition: Rtypes.h:91
static TEveGeoShape * ImportShapeExtract(TEveGeoShapeExtract *gse, TEveElement *parent=0)
Import a shape extract &#39;gse&#39; under element &#39;parent&#39;.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:155
virtual void Close(Option_t *option="")
Close a file.
Definition: TFile.cxx:904
virtual void AddScene(TEveScene *scene)
Add &#39;scene&#39; to the list of scenes.
Definition: TEveViewer.cxx:261