Prepare for the new TPC layout
[u/mrichter/AliRoot.git] / EVE / macros / auto_rotate.C
CommitLineData
2e79453d 1// $Header: /soft/cvsroot/AliRoot/EVE/test-macros/tpc_gui.C,v 1.7 2006/10/26 13:24:33 mtadel Exp $
2
3// Function to spawn a gui for reading rootified raw-data from TPC sector test.
4//
5// To use:
6// a) select TPCLoader entry in the list-tree view;
7// you'll get a dialog to steer the data-loading process in an adjacent window
8// b) to select a ROOT file containing the raw-data double-click on 'File:'
9// text entry to spawn a file-dialog or type in the name
10// c) click open to actually open the file and load an event
11
12#ifndef __CINT__
13
14#include <TEveUtil.h>
15#include "TGLViewer.h"
16#include "TTimer.h"
17
18#endif
19
20TTimer *g_rotate_timer = 0;
21Double_t g_rotate_speed = 1;
22Double_t g_rotate_theta = 0;
23
24void auto_rotate(Long_t time=25, Double_t speed=1)
25{
26 if (g_rotate_timer == 0)
27 {
28 g_rotate_timer = new TTimer;
29 }
30 g_rotate_speed = speed;
31 g_rotate_theta = 0;
32 g_rotate_timer->SetCommand("auto_rotate_camera()");
33 g_rotate_timer->Start(time);
34}
35
36void auto_rotate_stop()
37{
38 if (g_rotate_timer == 0)
39 {
40 Error("auto_rotate_stop", "timer not initialized.");
41 return;
42 }
43 g_rotate_timer->Stop();
44}
45
46void auto_rotate_camera()
47{
48 static Double_t hRotateStep = 0.005;
49 static Double_t vRotateStep = 0.025;
50
51 g_rotate_theta += hRotateStep * g_rotate_speed;
52 if (g_rotate_theta >= 0.8 || g_rotate_theta <= -0.8)
53 {
54 hRotateStep = -hRotateStep;
55 }
56
68ca2fe7 57 TGLViewer *v = gEve->GetDefaultGLViewer();
2e79453d 58 TGLCamera &cam = v->CurrentCamera();
59 cam.RotateRad(hRotateStep * g_rotate_speed, vRotateStep * g_rotate_speed);
60 v->RequestDraw(TGLRnrCtx::kLODHigh);
61}