3 // Root macro that opens a mini GUI for running aliroot with Geant4.
5 // To run aliroot with Geant4 using the g4menu.C:
7 // root [0] .x g4menu.C
8 // --> Select "Init" and then "Run" button
10 // The the bar enables to start Geant4 interactive session:
11 // --> Select "Geant4UI" button and use Geant4 interactive commands;
12 // In case TGeant4 has not yet been created you need first
13 // select "Geant4" button before selecting "Geant4UI".
14 // To go back to Root UI, type exit.
22 // Load Geant4 libraries
23 if (!gInterpreter->IsLoaded("$ALICE/geant4_vmc/examples/macro/g4libs.C"))
24 gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C");
25 gInterpreter->ProcessLine("g4libs()");
28 TControlBar* menu = new TControlBar("vertical","Alice Geant4 menu");
30 menu->AddButton("Init", "gAlice->Init(\"g4Config.C\")", "Initialize \" AliRun \"");
31 menu->AddButton("Run", "gAlice->Run()", "Process Alice run");
32 menu->AddButton("Geant4", "CreateGeant4()", "Create Geant4 only (without initializing AliRun)");
33 menu->AddButton("Geant4UI", "StartGeant4UI()","Go to Geant4 Interactive session");
34 menu->AddButton("XML", "GenerateXML()","Generate XML (AGDD) file with geometry description");
35 menu->AddButton("Quit", "Quit()", "Quit aliroot");
44 // TG4RunConfiguration for Geant4
45 TG4RunConfiguration* runConfiguration
46 = new TG4RunConfiguration(true);
50 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
52 cout << "Geant4 has been created." << endl;
55 cout << "Monte Carlo has been already created." << endl;
62 // release Root terminal control
64 // go into non-raw term mode
65 Getlinem(kCleanUp, 0);
67 // add test if gMC is TGeant4
68 TGeant4* g4 = (TGeant4*)gMC;
73 Getlinem(kInit, ((TRint*)gROOT->GetApplication())->GetPrompt());
76 cout << "Monte Carlo has not been yet created." << endl;
83 // release Root terminal control
85 // go into non-raw term mode
86 //Getlinem(kCleanUp, 0);
88 // add test if gMC is TGeant4
89 TGeant4* g4 = (TGeant4*)gMC;
91 g4->ProcessGeantCommand("/xml/generateAGDD");
94 //Getlinem(kInit, ((TRint*)gROOT->GetApplication())->GetPrompt());
97 cout << "Monte Carlo has not been yet created." << endl;
103 delete gAlice->GetRunLoader();