7 #include <TGeoManager.h>
16 //______________________________________________________________________
22 Exc_t operator+(const Exc_t &s1, const std::string &s2)
23 { return Exc_t((std::string&)s1 + s2); }
25 Exc_t operator+(const Exc_t &s1, const TString &s2)
26 { return Exc_t((std::string&)s1 + s2.Data()); }
28 Exc_t operator+(const Exc_t &s1, const char *s2)
29 { return Exc_t((std::string&)s1 + s2); }
32 void WarnCaller(const TString& warning)
34 std::cout << "WRN: " << warning << std::endl;
37 void ColorFromIdx(Color_t ci, UChar_t* col)
39 TColor* c = gROOT->GetColor(ci);
41 col[0] = (UChar_t)(255*c->GetRed());
42 col[1] = (UChar_t)(255*c->GetGreen());
43 col[2] = (UChar_t)(255*c->GetBlue());
48 /**************************************************************************/
49 /**************************************************************************/
51 void SetupEnvironment()
53 // Check REVESYS exists, try fallback to $ALICE_ROOT/EVE.
55 static const Exc_t eH("Reve::SetupEnvironment");
57 if(gSystem->Getenv("REVESYS") == 0) {
58 if(gSystem->Getenv("ALICE_ROOT") != 0) {
59 Info(eH.Data(), "setting REVESYS from ALICE_ROOT.");
60 gSystem->Setenv("REVESYS", Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
62 Error(eH.Data(), "REVESYS not defined, neither is ALICE_ROOT.");
66 if(gSystem->AccessPathName(gSystem->Getenv("REVESYS")) == kTRUE) {
67 Error(eH.Data(), "REVESYS '%s' does not exist.", gSystem->Getenv("REVESYS"));
72 /**************************************************************************/
75 void ChompTail(TString& s, char c='.') {
82 void AssertMacro(const Text_t* mac)
84 // Load and execute macro 'mac' if it has not been loaded yet.
86 TString foo(mac); ChompTail(foo);
87 if(gROOT->GetGlobalFunction(foo.Data(), 0, true) == 0) {
92 void Macro(const Text_t* mac)
94 // Execute macro 'mac'. Do not reload the macro.
96 TString foo(mac); ChompTail(foo);
97 if(gROOT->GetGlobalFunction(foo.Data(), 0, true) == 0)
98 gROOT->LoadMacro(mac);
101 gROOT->ProcessLine(foo.Data());
104 void LoadMacro(const Text_t* mac)
106 // Makes sure that macro 'mac' is loaded, but do not reload it.
108 TString foo(mac); ChompTail(foo);
109 if(gROOT->GetGlobalFunction(foo.Data(), 0, true) == 0)
110 gROOT->LoadMacro(mac);
113 /**************************************************************************/
114 /**************************************************************************/
116 // Pad stack for RINT/GUI thread.
117 std::list<TVirtualPad*> s_Pad_Stack;
119 TVirtualPad* PushPad(TVirtualPad* new_gpad, Int_t subpad)
121 // printf("Reve::PushPad old=%p, new=%p\n", gPad, new_gpad);
122 s_Pad_Stack.push_back(gPad);
124 new_gpad->cd(subpad);
130 TVirtualPad* PopPad(Bool_t modify_update_p)
132 // printf("Reve::PopPad old=%p, new=%p\n", gPad, s_Pad_Stack.empty() ? 0 : s_Pad_Stack.back());
133 if(s_Pad_Stack.empty()) {
134 Warning("Reve::PopTPad", "stack empty.");
136 if(modify_update_p && gPad != 0) {
140 gPad = s_Pad_Stack.back();
141 s_Pad_Stack.pop_back();
146 /**************************************************************************/
148 /**************************************************************************/
150 GeoManagerHolder::GeoManagerHolder(TGeoManager* new_gmgr) :
151 fManager(gGeoManager)
153 gGeoManager = new_gmgr;
156 GeoManagerHolder::~GeoManagerHolder()
158 gGeoManager = fManager;