swh:1:snp:af87cd67498ef4fe47c76ed3e7caffe5b61facaf
Raw File
Tip revision: 7af9cdc262b7a0cf2679a0df6c639c93656958c0 authored by Axel Naumann on 06 November 2023, 16:45:30 UTC
[foundation] Update version file to 6.30.01: dev phase for upcoming patch release.
Tip revision: 7af9cdc
projection.C
/// \file
/// \ingroup tutorial_eve
/// Demonstrates usage of automatic 2D projections - class TEveProjectionManager.
///
/// \image html eve_projection.png
/// \macro_code
///
/// \author Matevz Tadel

const char* esd_geom_file_name =
   "http://root.cern.ch/files/alice_ESDgeometry.root";

void projection()
{
   TFile::SetCacheFileDir(".");
   TEveManager::Create();

   // 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
   auto mng = new TEveProjectionManager(TEveProjection::kPT_RPhi);
   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);
}
back to top