]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/macro/g4menu.C
adapted to new design, has to be completed
[u/mrichter/AliRoot.git] / AliGeant4 / macro / g4menu.C
1 // $Id$
2
3 #include <iostream.h>
4
5 void g4menu()
6 {
7   // load Geant4 libraries
8   if (!gInterpreter->IsLoaded("g4libs.C")) gROOT->LoadMacro("g4libs.C");
9   gInterpreter->ProcessLine("g4libs()");
10
11   // load AliRoot core libraries
12   gInterpreter->ProcessLine("steerlibs()");
13
14   // menu
15   TControlBar* menu = new TControlBar("vertical","Alice Geant4 menu");
16   
17   menu->AddButton("Geant4",   "CreateGeant4()", "Create Geant4 Monte Carlo");
18   menu->AddButton("Geant4UI", "StartGeant4UI()","Go to Geant4 Interactive session");
19   menu->AddButton("Init",     "gAlice->Init()", "Initialize AliRun");
20   menu->AddButton("Run",      "gAlice->Run()",  "Process Alice run");
21   menu->AddButton("Run Lego", "gAlice->RunLego()", "Process special lego run");
22   gROOT->SaveContext();
23   menu->Show();
24 }
25
26 void CreateGeant4()
27 {
28   if (!gMC) {
29     // AliRunConfiguration for Geant4
30     AliRunConfiguration* runConfiguration 
31       = new AliRunConfiguration();
32   
33     // TGeant4
34     TGeant4* geant4
35       = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
36
37     cout << "Geant4 has been created." << endl;
38    }      
39   else {
40     cout << "Monte Carlo has been already created." << endl;
41   }       
42 }    
43
44 void StartGeant4UI()
45 {
46   if (gMC) {
47     // release Root terminal control
48
49     // go into non-raw term mode
50     Getlinem(kCleanUp, 0);
51     
52     // add test if gMC is TGeant4
53     TGeant4* g4 = (TGeant4*)gMC;
54   
55     g4->StartGeantUI();
56
57     // new Root prompt
58     Getlinem(kInit, ((TRint*)gROOT->GetApplication())->GetPrompt());  
59   }
60   else {  
61     cout << "Monte Carlo has not been yet created." << endl;
62   }       
63 }  
64