When calculating a*a-b*b the form (a-b)*(a+b) is usually more numerically stable.
[u/mrichter/AliRoot.git] / macros / menu.C
CommitLineData
4a67c433 1TControlBar *menu;
2
fe4da5cc 3void menu(const char *config="Config.C")
4{
4a67c433 5 menu = new TControlBar("vertical","gAlice menu");
fe4da5cc 6 menu->AddButton(" Help to run gAlice ","AliceHelp()", "Explains how to use gAlice menus");
7 menu->AddButton("Run", "gAlice->Run()","Process an Alice event");
8 menu->AddButton("Run Lego", "gAlice->RunLego()","Special run to generate the radl/absl lego plots");
9 menu->AddButton("Top view", "DrawTopView()","Draw Top view (cut) of Alice");
10 menu->AddButton("Side view", "DrawSideView()","Draw Side view (cut) of Alice");
11 menu->AddButton("Front view", "DrawFrontView()","Draw Front view (cut) of Alice");
12 menu->AddButton("Menu Trees", ".x DrawTrees.C","Menu to display the Alice Geant trees");
13 menu->AddButton("Menu Pictures", ".x DrawPictures.C","Menu to display detectors in shaded mode");
14 menu->AddButton("Hide ON", "SetHide(1)","Activate drawing option HIDE");
15 menu->AddButton("Hide OFF", "SetHide(0)","DeActivate drawing option HIDE");
16 menu->AddButton("Shading ON", "SetShade(1)","Activate drawing option SHAD");
17 menu->AddButton("Shading OFF", "SetShade(0)","DeActivate drawing option SHAD");
18// menu->AddButton("RayTracing ON", "SetRayTracing(1)","Activate drawing option RAYT");
19// menu->AddButton("RayTracing OFF", "SetRayTracing(0)","DeActivate drawing option RAYT");
20 menu->AddButton("Box Clip ON", "SetBoxClip(1)","Activate clipping box");
21 menu->AddButton("Box Clip OFF", "SetBoxClip(0)","DeActivate clipping box");
22// menu->AddButton("Parallel view", "SetViewType(1)","Set Parallel view");
23// menu->AddButton("Perspective view","SetViewType(0)","Set Perspective view");
24 gROOT->SaveContext();
25
26 gAlice->Init(config);
27 ((TGeant3*)gMC)->InitHIGZ();
28 menu->Show();
29}
30
31void AliceHelp()
32{
33 gSystem->Exec("nedit AliceHelp.C &");
34}
35
36void SetRange()
37{
38 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
39 if (higz) higz->Range(0,0,20,20);
40}
41
42void DrawTopView()
43{
44 printf("Generating TOP view of Alice. Be patient one minute!\n");
45 SetRange();
46 ((TGeant3*)gMC)->Gdrawc("ALIC",2,0,10,10,0.01,0.01);
47}
48
49void DrawSideView()
50{
51 printf("Generating SIDE view of Alice. Be patient one minute!\n");
52 SetRange();
53 ((TGeant3*)gMC)->Gdrawc("ALIC",1,0,10,10,0.01,0.01);
54}
55
56void DrawFrontView()
57{
58 printf("Generating FRONT view of Alice. Be patient one minute!\n");
59 SetRange();
60 ((TGeant3*)gMC)->Gdrawc("ALIC",3,0,10,10,0.01,0.01);
61}
62
63void SetHide(Int_t opt)
64{
65 if (opt) {
66 printf("Drawing option HIDE is ACTIVE!\n");
67 ((TGeant3*)gMC)->Gdopt("HIDE","ON");
68 } else {
69 printf("Drawing option HIDE is NOT ACTIVE!\n");
70 ((TGeant3*)gMC)->Gdopt("HIDE","OFF");
71 }
72}
73
74void SetShade(Int_t opt)
75{
76 if (opt) {
77 printf("Drawing option SHAD is ACTIVE!\n");
78 ((TGeant3*)gMC)->Gdopt("SHAD","ON");
79 } else {
80 printf("Drawing option SHAD is NOT ACTIVE!\n");
81 ((TGeant3*)gMC)->Gdopt("SHAD","OFF");
82 }
83}
84
85void SetRayTracing(Int_t opt)
86{
87 if (opt) {
88 printf("Drawing option RAYT is ACTIVE!\n");
89 ((TGeant3*)gMC)->Gdopt("RAYT","ON");
90 } else {
91 printf("Drawing option RAYT is NOT ACTIVE!\n");
92 ((TGeant3*)gMC)->Gdopt("RAYT","OFF");
93 }
94}
95
96void SetBoxClip(Int_t opt)
97{
98 if (opt) {
99 printf("Clipping BOX is ACTIVE!\n");
100 ((TGeant3*)gMC)->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
101 } else {
102 printf("Clipping BOX is NOT ACTIVE!\n");
103 ((TGeant3*)gMC)->SetClipBox(".");
104 }
105}
106
107void SetViewType(Int_t opt)
108{
109 if (opt) {
110 printf("Setting PARALLEL view!\n");
111 ((TGeant3*)gMC)->Gdopt("PROJ","PARA");
112 } else {
113 printf("Setting PERSPECTIVE view!\n");
114 ((TGeant3*)gMC)->Gdopt("PROJ","PERS");
115 }
116}