00001
00002
00003
00004
00005
00006 const char* esd_geom_file_name =
00007 "http://root.cern.ch/files/alice_ESDgeometry.root";
00008
00009 void projection_prescale()
00010 {
00011 TFile::SetCacheFileDir(".");
00012 TEveManager::Create();
00013
00014 TEveViewer *pev = gEve->SpawnNewViewer("Projections");
00015
00016
00017 TEveScene* s = gEve->SpawnNewScene("Projected Geom");
00018 pev->AddScene(s);
00019
00020 TGLViewer* pgv = pev->GetGLViewer();
00021 pgv->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
00022 TGLOrthoCamera* cam = (TGLOrthoCamera*) pgv->CurrentCamera();
00023 cam->SetZoomMinMax(0.2, 20);
00024
00025
00026 TEveProjectionManager* mng = new TEveProjectionManager();
00027 {
00028 mng->SetProjection(TEveProjection::kPT_RPhi);
00029 TEveProjection* p = mng->GetProjection();
00030 p->AddPreScaleEntry(0, 0, 4);
00031 p->AddPreScaleEntry(0, 45, 1);
00032 p->AddPreScaleEntry(0, 310, 0.5);
00033 p->SetUsePreScale(kTRUE);
00034 }
00035 {
00036 mng->SetProjection(TEveProjection::kPT_RhoZ);
00037 TEveProjection* p = mng->GetProjection();
00038
00039 p->AddPreScaleEntry(0, 0, 4);
00040 p->AddPreScaleEntry(1, 0, 4);
00041
00042 p->AddPreScaleEntry(0, 45, 1);
00043 p->AddPreScaleEntry(1, 110, 1);
00044
00045 p->AddPreScaleEntry(0, 310, 0.5);
00046 p->AddPreScaleEntry(1, 250, 0.5);
00047 p->SetUsePreScale(kTRUE);
00048 }
00049 mng->SetProjection(TEveProjection::kPT_RPhi);
00050 s->AddElement(mng);
00051
00052 TEveProjectionAxes* axes = new TEveProjectionAxes(mng);
00053 s->AddElement(axes);
00054 gEve->AddToListTree(axes, kTRUE);
00055 gEve->AddToListTree(mng, kTRUE);
00056
00057
00058 TFile* geom = TFile::Open(esd_geom_file_name, "CACHEREAD");
00059 if (!geom)
00060 return;
00061
00062 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) geom->Get("Gentle");
00063 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse, 0);
00064 geom->Close();
00065 delete geom;
00066 gEve->AddGlobalElement(gsre);
00067 mng->ImportElements(gsre);
00068
00069 TEveLine* line = new TEveLine;
00070 line->SetMainColor(kGreen);
00071 for (Int_t i=0; i<160; ++i)
00072 line->SetNextPoint(120*sin(0.2*i), 120*cos(0.2*i), 80-i);
00073 gEve->AddElement(line);
00074 mng->ImportElements(line);
00075 line->SetRnrSelf(kFALSE);
00076
00077
00078
00079
00080
00081
00082 TEveViewer *sev = gEve->SpawnNewViewer("Scaled 3D");
00083 TEveProjectionManager* smng =
00084 new TEveProjectionManager(TEveProjection::kPT_3D);
00085 TEveProjection* sp = smng->GetProjection();
00086 sp->SetUsePreScale(kTRUE);
00087 sp->AddPreScaleEntry(2, 0, 1);
00088 sp->AddPreScaleEntry(2, 100, 0.2);
00089
00090 TEveScene* ss = gEve->SpawnNewScene("Scaled Geom");
00091 sev->AddScene(ss);
00092 ss->AddElement(smng);
00093
00094 smng->ImportElements(gsre);
00095
00096
00097
00098 gEve->GetBrowser()->GetTabRight()->SetTab(1);
00099
00100 gEve->Redraw3D(kTRUE);
00101 }