From $ROOTSYS/tutorials/eve/projection_prescale.C

// @(#)root/eve:$Id$
// Author: Matevz Tadel

// Demonstates usage pre-scaling for automatic 2D projections.

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

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

   TEveViewer *pev = gEve->SpawnNewViewer("Projections");

   // camera
   TEveScene* s = gEve->SpawnNewScene("Projected Geom");
   pev->AddScene(s);

   TGLViewer* pgv = pev->GetGLViewer();
   pgv->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
   TGLOrthoCamera& cam = (TGLOrthoCamera&) pgv->CurrentCamera();
   cam.SetZoomMinMax(0.2, 20);

   // projections
   TEveProjectionManager* mng = new TEveProjectionManager();
   {
      mng->SetProjection(TEveProjection::kPT_RPhi);
      TEveProjection* p = mng->GetProjection();
      p->AddPreScaleEntry(0, 0,   4);    // r scale 4 from 0
      p->AddPreScaleEntry(0, 45,  1);    // r scale 1 from 45
      p->AddPreScaleEntry(0, 310, 0.5);
      p->SetUsePreScale(kTRUE);
   }
   {
      mng->SetProjection(TEveProjection::kPT_RhoZ);
      TEveProjection* p = mng->GetProjection();
      // Increase silicon tracker
      p->AddPreScaleEntry(0, 0, 4);     // rho scale 4 from 0
      p->AddPreScaleEntry(1, 0, 4);     // z   scale 4 from 0
      // Normal for TPC
      p->AddPreScaleEntry(0, 45,  1);   // rho scale 1 from 45
      p->AddPreScaleEntry(1, 110, 1);   // z   scale 1 from 110
      // Reduce the rest
      p->AddPreScaleEntry(0, 310, 0.5);
      p->AddPreScaleEntry(1, 250, 0.5);
      p->SetUsePreScale(kTRUE);
   }
   mng->SetProjection(TEveProjection::kPT_RPhi);
   s->AddElement(mng);

   TEveProjectionAxes* axes = new TEveProjectionAxes(mng);
   s->AddElement(axes);
   gEve->AddToListTree(axes, kTRUE);
   gEve->AddToListTree(mng, kTRUE);

   // Simple geometry
   TFile* geom = TFile::Open(esd_geom_file_name, "CACHEREAD");
   if (!geom)
      return;

   TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) geom->Get("Gentle");
   TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse, 0);
   geom->Close();
   delete geom;
   gEve->AddGlobalElement(gsre);
   mng->ImportElements(gsre);

   TEveLine* 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);


   //-------------------------------------------------------------------------
   // Scaled 3D "projection"
   //-------------------------------------------------------------------------

   TEveViewer *sev = gEve->SpawnNewViewer("Scaled 3D");
   TEveProjectionManager* smng =
      new TEveProjectionManager(TEveProjection::kPT_3D);
   TEveProjection* sp = smng->GetProjection();
   sp->SetUsePreScale(kTRUE);
   sp->AddPreScaleEntry(2,   0,  1);
   sp->AddPreScaleEntry(2, 100,  0.2);

   TEveScene* ss = gEve->SpawnNewScene("Scaled Geom");
   sev->AddScene(ss);
   ss->AddElement(smng);

   smng->ImportElements(gsre);

   //-------------------------------------------------------------------------

   gEve->GetBrowser()->GetTabRight()->SetTab(1);

   gEve->Redraw3D(kTRUE);
}
 projection_prescale.C:1
 projection_prescale.C:2
 projection_prescale.C:3
 projection_prescale.C:4
 projection_prescale.C:5
 projection_prescale.C:6
 projection_prescale.C:7
 projection_prescale.C:8
 projection_prescale.C:9
 projection_prescale.C:10
 projection_prescale.C:11
 projection_prescale.C:12
 projection_prescale.C:13
 projection_prescale.C:14
 projection_prescale.C:15
 projection_prescale.C:16
 projection_prescale.C:17
 projection_prescale.C:18
 projection_prescale.C:19
 projection_prescale.C:20
 projection_prescale.C:21
 projection_prescale.C:22
 projection_prescale.C:23
 projection_prescale.C:24
 projection_prescale.C:25
 projection_prescale.C:26
 projection_prescale.C:27
 projection_prescale.C:28
 projection_prescale.C:29
 projection_prescale.C:30
 projection_prescale.C:31
 projection_prescale.C:32
 projection_prescale.C:33
 projection_prescale.C:34
 projection_prescale.C:35
 projection_prescale.C:36
 projection_prescale.C:37
 projection_prescale.C:38
 projection_prescale.C:39
 projection_prescale.C:40
 projection_prescale.C:41
 projection_prescale.C:42
 projection_prescale.C:43
 projection_prescale.C:44
 projection_prescale.C:45
 projection_prescale.C:46
 projection_prescale.C:47
 projection_prescale.C:48
 projection_prescale.C:49
 projection_prescale.C:50
 projection_prescale.C:51
 projection_prescale.C:52
 projection_prescale.C:53
 projection_prescale.C:54
 projection_prescale.C:55
 projection_prescale.C:56
 projection_prescale.C:57
 projection_prescale.C:58
 projection_prescale.C:59
 projection_prescale.C:60
 projection_prescale.C:61
 projection_prescale.C:62
 projection_prescale.C:63
 projection_prescale.C:64
 projection_prescale.C:65
 projection_prescale.C:66
 projection_prescale.C:67
 projection_prescale.C:68
 projection_prescale.C:69
 projection_prescale.C:70
 projection_prescale.C:71
 projection_prescale.C:72
 projection_prescale.C:73
 projection_prescale.C:74
 projection_prescale.C:75
 projection_prescale.C:76
 projection_prescale.C:77
 projection_prescale.C:78
 projection_prescale.C:79
 projection_prescale.C:80
 projection_prescale.C:81
 projection_prescale.C:82
 projection_prescale.C:83
 projection_prescale.C:84
 projection_prescale.C:85
 projection_prescale.C:86
 projection_prescale.C:87
 projection_prescale.C:88
 projection_prescale.C:89
 projection_prescale.C:90
 projection_prescale.C:91
 projection_prescale.C:92
 projection_prescale.C:93
 projection_prescale.C:94
 projection_prescale.C:95
 projection_prescale.C:96
 projection_prescale.C:97
 projection_prescale.C:98
 projection_prescale.C:99
 projection_prescale.C:100
 projection_prescale.C:101
 projection_prescale.C:102