#include <RootEnv.h>
Public Member Functions | |
| RootEnv (int argc, char **argv) | |
| ~RootEnv () | |
| int | Run () |
Private Member Functions | |
| void | InterpreterConfig () |
| void | SignalConfig () |
| void | LoadIncludes () |
| void | LoadClasses () |
Private Attributes | |
| TRint * | fTheApp |
| The root application. | |
Definition at line 14 of file RootEnv.h.
|
||||||||||||
|
Definition at line 26 of file RootEnv.cxx. References fTheApp, InterpreterConfig(), LoadClasses(), LoadIncludes(), and SignalConfig().
00027 {
00028 //======================================================================
00029 // Setup the root environment for a program started with command line
00030 // options argc and argv
00031 //======================================================================
00032 assert(gROOT);
00033
00034 TApplication* app = gROOT->GetApplication();
00035 if (app == 0) {
00036 // TGClient* client = new TGClient("0.0");
00037 int largc = 0;
00038 char** largv = 0;
00039 fTheApp = new TRint("TAPP",&largc, largv, 0, 0, kTRUE);
00040
00041 // assert(rint == gROOT->GetApplication());
00042 std::string p = gSystem->BaseName(argv[0]); p+= " [%d] ";
00043 fTheApp->SetPrompt(p.c_str());
00044
00045 this->SignalConfig();
00046 this->InterpreterConfig();
00047 this->LoadIncludes();
00048 this->LoadClasses();
00049
00050 gROOT->SetStyle("Plain");
00051 gStyle->SetOptStat(0);
00052 }
00053 }
|
|
|
Definition at line 57 of file RootEnv.cxx.
00058 {
00059 // ROOT takes care of the following delete so don't do it twice
00060 // if (fTheApp) { delete fTheApp; fTheApp = 0; }
00061 }
|
|
|
Definition at line 80 of file RootEnv.cxx. Referenced by RootEnv().
00081 {
00082 //======================================================================
00083 // Configure the root interpreter
00084 //======================================================================
00085 if (gInterpreter) { // gInterpreter from TInterpreter.h
00086 gInterpreter->SaveContext();
00087 gInterpreter->SaveGlobalsContext();
00088 }
00089 }
|
|
|
Definition at line 169 of file RootEnv.cxx. Referenced by RootEnv().
00170 {
00171 //======================================================================
00172 // Load classes to make the root session more covenient
00173 //======================================================================
00174 if (gROOT) {
00175 gROOT->LoadClass("TGeometry", "Graf3d");
00176 gROOT->LoadClass("TTree", "Tree");
00177 gROOT->LoadClass("TMatrix", "Matrix");
00178 gROOT->LoadClass("TMinuit", "Minuit");
00179 gROOT->LoadClass("TPostScript", "Postscript");
00180 gROOT->LoadClass("TCanvas", "Gpad");
00181 gROOT->LoadClass("THtml", "Html");
00182 }
00183 }
|
|
|
Definition at line 120 of file RootEnv.cxx. Referenced by RootEnv().
00121 {
00122 //======================================================================
00123 // Load include files to make the root session more covenient
00124 //======================================================================
00125 TApplication* app = gROOT->GetApplication();
00126 if (app) {
00127 // Load a set of useful C++ includes.
00128 // app->ProcessLine("#include <iostream>"); // Root gets this one itself
00129 app->ProcessLine("#include <iomanip>");
00130 app->ProcessLine("#include <string>");
00131
00132 // Load experiment include files
00133 std::string mp = gROOT->GetMacroPath();
00134 std::string ip;
00135 const char* p;
00136 p = gSystem->Getenv("SRT_PRIVATE_CONTEXT");
00137 if (p) {
00138 mp += ":";
00139 mp += p;
00140 mp += ":";
00141 mp += p;
00142 mp += "/macros";
00143 ip += " -I";
00144 ip += p;
00145 }
00146 p = gSystem->Getenv("SRT_PUBLIC_CONTEXT");
00147 if (p) {
00148 mp += ":";
00149 mp += p;
00150 mp += "/macros";
00151 ip += " -I";
00152 ip += p;
00153 }
00154
00155 gROOT->SetMacroPath(mp.c_str());
00156 gSystem->SetIncludePath(ip.c_str());
00157
00158 std::string dip = ".include ";
00159 dip += gSystem->Getenv("SRT_PRIVATE_CONTEXT");
00160 gROOT->ProcessLine(dip.c_str());
00161 dip = ".include ";
00162 dip += gSystem->Getenv("SRT_PUBLIC_CONTEXT");
00163 gROOT->ProcessLine(dip.c_str());
00164 }
00165 }
|
|
|
Definition at line 65 of file RootEnv.cxx. Referenced by main().
00066 {
00067 //======================================================================
00068 // Turn control of the application over to ROOT's event loop
00069 //======================================================================
00070 TApplication* app = gROOT->GetApplication();
00071 if (app) {
00072 app->Run(kTRUE); // kTRUE == "Return from run" request...
00073 return 1;
00074 }
00075 return 0;
00076 }
|
|
|
Definition at line 93 of file RootEnv.cxx. Referenced by RootEnv().
00094 {
00095 //======================================================================
00096 // Configure root's signale handlers
00097 //======================================================================
00098 if (gSystem) { // gSystem from TSystem.h
00099 // Reset ROOT's signal handling to the defaults...
00100 gSystem->ResetSignal(kSigBus, kTRUE);
00101 gSystem->ResetSignal(kSigSegmentationViolation,kTRUE);
00102 gSystem->ResetSignal(kSigSystem, kTRUE);
00103 gSystem->ResetSignal(kSigPipe, kTRUE);
00104 gSystem->ResetSignal(kSigIllegalInstruction, kTRUE);
00105 gSystem->ResetSignal(kSigQuit, kTRUE);
00106 gSystem->ResetSignal(kSigInterrupt, kTRUE);
00107 gSystem->ResetSignal(kSigWindowChanged, kTRUE);
00108 gSystem->ResetSignal(kSigAlarm, kTRUE);
00109 gSystem->ResetSignal(kSigChild, kTRUE);
00110 gSystem->ResetSignal(kSigUrgent, kTRUE);
00111 gSystem->ResetSignal(kSigFloatingException, kTRUE);
00112 gSystem->ResetSignal(kSigTermination, kTRUE);
00113 gSystem->ResetSignal(kSigUser1, kTRUE);
00114 gSystem->ResetSignal(kSigUser2, kTRUE);
00115 }
00116 }
|
|
|
The root application.
Definition at line 28 of file RootEnv.h. Referenced by RootEnv(). |
1.3.5