Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches

Detailed Description

Demonstrates usage of automatic 2D projections - class TEveProjectionManager.

const char *esd_geom_file_name = "http://root.cern/files/alice_ESDgeometry.root";
void projection()
{
// camera
auto s = gEve->SpawnNewScene("Projected Event");
gEve->GetDefaultViewer()->AddScene(s);
auto v = gEve->GetDefaultGLViewer();
v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
TGLOrthoCamera &cam = (TGLOrthoCamera &)v->CurrentCamera();
cam.SetZoomMinMax(0.2, 20);
// projections
s->AddElement(mng);
auto axes = new TEveProjectionAxes(mng);
axes->SetTitle("TEveProjections demo");
s->AddElement(axes);
gEve->AddToListTree(axes, kTRUE);
gEve->AddToListTree(mng, kTRUE);
// Simple geometry
auto geom = TFile::Open(esd_geom_file_name, "CACHEREAD");
if (!geom)
return;
auto gse = (TEveGeoShapeExtract *)geom->Get("Gentle");
auto gsre = TEveGeoShape::ImportShapeExtract(gse, 0);
geom->Close();
delete geom;
gsre->SetPickableRecursively(kTRUE);
gEve->AddGlobalElement(gsre);
gEve->GetGlobalScene()->SetRnrState(kFALSE);
mng->ImportElements(gsre);
auto line = new TEveLine;
line->SetMainColor(kGreen);
for (Int_t i = 0; i < 160; ++i)
line->SetNextPoint(120 * sin(0.2 * i), 120 * cos(0.2 * i), 80 - i);
gEve->AddElement(line);
mng->ImportElements(line);
line->SetRnrSelf(kFALSE);
gEve->Redraw3D(kTRUE);
}
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
@ kGreen
Definition Rtypes.h:67
externTEveManager * gEve
Globally positioned TGeoShape with rendering attributes and an optional list of daughter shape-extrac...
static TEveGeoShape * ImportShapeExtract(TEveGeoShapeExtract *gse, TEveElement *parent=nullptr)
Import a shape extract 'gse' under element 'parent'.
An arbitrary polyline with fixed line and marker attributes.
Definition TEveLine.h:26
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
Axes for non-linear projections.
Manager class for steering of projections and managing projected objects.
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:3787
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
Definition TFile.cxx:4328
Orthographic projection camera.
void SetZoomMinMax(Double_t min, Double_t max)
@ kCameraOrthoXOY
Definition TGLViewer.h:62
TLine * line
Author
Matevz Tadel

Definition in file projection.C.