ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TROOT.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Rene Brun 08/12/94
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TROOT
13 ROOT top level object description.
14 
15  The TROOT object is the entry point to the ROOT system.
16  The single instance of TROOT is accessible via the global gROOT.
17  Using the gROOT pointer one has access to basically every object
18  created in a ROOT based program. The TROOT object is essentially a
19  container of several lists pointing to the main ROOT objects.
20 
21  The following lists are accessible from gROOT object:
22 
23 ~~~ {.cpp}
24  gROOT->GetListOfClasses
25  gROOT->GetListOfColors
26  gROOT->GetListOfTypes
27  gROOT->GetListOfGlobals
28  gROOT->GetListOfGlobalFunctions
29  gROOT->GetListOfFiles
30  gROOT->GetListOfMappedFiles
31  gROOT->GetListOfSockets
32  gROOT->GetListOfSecContexts
33  gROOT->GetListOfCanvases
34  gROOT->GetListOfStyles
35  gROOT->GetListOfFunctions
36  gROOT->GetListOfSpecials (for example graphical cuts)
37  gROOT->GetListOfGeometries
38  gROOT->GetListOfBrowsers
39  gROOT->GetListOfCleanups
40  gROOT->GetListOfMessageHandlers
41 ~~~
42 
43  The TROOT class provides also many useful services:
44  - Get pointer to an object in any of the lists above
45  - Time utilities TROOT::Time
46 
47  The ROOT object must be created as a static object. An example
48  of a main program creating an interactive version is shown below:
49 
50 ### Example of a main program
51 
52 ~~~ {.cpp}
53  #include "TRint.h"
54 
55  int main(int argc, char **argv)
56  {
57  TRint *theApp = new TRint("ROOT example", &argc, argv);
58 
59  // Init Intrinsics, build all windows, and enter event loop
60  theApp->Run();
61 
62  return(0);
63  }
64 ~~~
65 */
66 
67 #include "RConfig.h"
68 #include "RConfigure.h"
69 #include "RConfigOptions.h"
70 #include "RVersion.h"
71 #include "RGitCommit.h"
72 
73 #include <string>
74 #include <map>
75 #include <stdlib.h>
76 #ifdef WIN32
77 #include <io.h>
78 #include "Windows4Root.h"
79 #include <Psapi.h>
80 #define RTLD_DEFAULT ((void *)::GetModuleHandle(NULL))
81 #define dlsym(library, function_name) ::GetProcAddress((HMODULE)library, function_name)
82 #define dlopen(library_name, flags) ::LoadLibrary(library_name)
83 #define dlclose(library) ::FreeLibrary((HMODULE)library)
84 char *dlerror() {
85  static char Msg[1000];
86  FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
87  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), Msg,
88  sizeof(Msg), NULL);
89  return Msg;
90 }
91 #else
92 #include <dlfcn.h>
93 #endif
94 
95 #include "Riostream.h"
96 #include "Gtypes.h"
97 #include "TROOT.h"
98 #include "TClass.h"
99 #include "TClassEdit.h"
100 #include "TClassGenerator.h"
101 #include "TDataType.h"
102 #include "TDatime.h"
103 #include "TStyle.h"
104 #include "TObjectTable.h"
105 #include "TClassTable.h"
106 #include "TSystem.h"
107 #include "THashList.h"
108 #include "TObjArray.h"
109 #include "TEnv.h"
110 #include "TError.h"
111 #include "TColor.h"
112 #include "TGlobal.h"
113 #include "TFunction.h"
114 #include "TVirtualPad.h"
115 #include "TBrowser.h"
116 #include "TSystemDirectory.h"
117 #include "TApplication.h"
118 #include "TInterpreter.h"
119 #include "TGuiFactory.h"
120 #include "TMessageHandler.h"
121 #include "TFolder.h"
122 #include "TQObject.h"
123 #include "TProcessUUID.h"
124 #include "TPluginManager.h"
125 #include "TMap.h"
126 #include "TObjString.h"
127 #include "TVirtualMutex.h"
128 #include "TInterpreter.h"
129 #include "TListOfTypes.h"
130 #include "TListOfDataMembers.h"
131 #include "TListOfEnumsWithLock.h"
132 #include "TListOfFunctions.h"
134 #include "TFunctionTemplate.h"
135 #include "ThreadLocalStorage.h"
136 
137 #include <string>
138 namespace std {} using namespace std;
139 
140 #if defined(R__UNIX)
141 #if defined(R__HAS_COCOA)
142 #include "TMacOSXSystem.h"
143 #include "TUrl.h"
144 #else
145 #include "TUnixSystem.h"
146 #endif
147 #elif defined(R__WIN32)
148 #include "TWinNTSystem.h"
149 #endif
150 
151 extern "C" void R__SetZipMode(int);
152 
154 static void *gInterpreterLib = 0;
155 
156 // Mutex for protection of concurrent gROOT access
158 
159 // For accessing TThread::Tsd indirectly.
160 void **(*gThreadTsd)(void*,Int_t) = 0;
161 
162 //-------- Names of next three routines are a small homage to CMZ --------------
163 ////////////////////////////////////////////////////////////////////////////////
164 /// Return version id as an integer, i.e. "2.22/04" -> 22204.
165 
166 static Int_t IVERSQ()
167 {
168  Int_t maj, min, cycle;
169  sscanf(ROOT_RELEASE, "%d.%d/%d", &maj, &min, &cycle);
170  return 10000*maj + 100*min + cycle;
171 }
172 
173 ////////////////////////////////////////////////////////////////////////////////
174 /// Return built date as integer, i.e. "Apr 28 2000" -> 20000428.
175 
176 static Int_t IDATQQ(const char *date)
177 {
178  static const char *months[] = {"Jan","Feb","Mar","Apr","May",
179  "Jun","Jul","Aug","Sep","Oct",
180  "Nov","Dec"};
181 
182  char sm[12];
183  Int_t yy, mm=0, dd;
184  sscanf(date, "%s %d %d", sm, &dd, &yy);
185  for (int i = 0; i < 12; i++)
186  if (!strncmp(sm, months[i], 3)) {
187  mm = i+1;
188  break;
189  }
190  return 10000*yy + 100*mm + dd;
191 }
192 
193 ////////////////////////////////////////////////////////////////////////////////
194 /// Return built time as integer (with min precision), i.e.
195 /// "17:32:37" -> 1732.
196 
197 static Int_t ITIMQQ(const char *time)
198 {
199  Int_t hh, mm, ss;
200  sscanf(time, "%d:%d:%d", &hh, &mm, &ss);
201  return 100*hh + mm;
202 }
203 
204 ////////////////////////////////////////////////////////////////////////////////
205 /// Clean up at program termination before global objects go out of scope.
206 
207 static void CleanUpROOTAtExit()
208 {
209  if (gROOT) {
211 
212  if (gROOT->GetListOfFiles())
213  gROOT->GetListOfFiles()->Delete("slow");
214  if (gROOT->GetListOfSockets())
215  gROOT->GetListOfSockets()->Delete();
216  if (gROOT->GetListOfMappedFiles())
217  gROOT->GetListOfMappedFiles()->Delete("slow");
218  if (gROOT->GetListOfClosedObjects())
219  gROOT->GetListOfClosedObjects()->Delete("slow");
220  }
221 }
222 
223 ////////////////////////////////////////////////////////////////////////////////
224 /// A module and its headers. Intentionally not a copy:
225 /// If these strings end up in this struct they are
226 /// long lived by definition because they get passed in
227 /// before initialization of TCling.
228 
229 namespace {
230  struct ModuleHeaderInfo_t {
231  ModuleHeaderInfo_t(const char* moduleName,
232  const char** headers,
233  const char** includePaths,
234  const char* payloadCode,
235  const char* fwdDeclCode,
236  void (*triggerFunc)(),
237  const TROOT::FwdDeclArgsToKeepCollection_t& fwdDeclsArgToSkip,
238  const char** classesHeaders):
239  fModuleName(moduleName),
240  fHeaders(headers),
241  fPayloadCode(payloadCode),
242  fFwdDeclCode(fwdDeclCode),
243  fIncludePaths(includePaths),
244  fTriggerFunc(triggerFunc),
245  fClassesHeaders(classesHeaders),
246  fFwdNargsToKeepColl(fwdDeclsArgToSkip){}
247 
248  const char* fModuleName; // module name
249  const char** fHeaders; // 0-terminated array of header files
250  const char* fPayloadCode; // Additional code to be given to cling at library load
251  const char* fFwdDeclCode; // Additional code to let cling know about selected classes and functions
252  const char** fIncludePaths; // 0-terminated array of header files
253  void (*fTriggerFunc)(); // Pointer to the dict initialization used to find the library name
254  const char** fClassesHeaders; // 0-terminated list of classes and related header files
255  const TROOT::FwdDeclArgsToKeepCollection_t fFwdNargsToKeepColl; // Collection of
256  // pairs of template fwd decls and number of
257  };
258 
259  std::vector<ModuleHeaderInfo_t>& GetModuleHeaderInfoBuffer() {
260  static std::vector<ModuleHeaderInfo_t> moduleHeaderInfoBuffer;
261  return moduleHeaderInfoBuffer;
262  }
263 }
264 
268 
269 static void at_exit_of_TROOT() {
272 }
273 
274 // This local static object initializes the ROOT system
275 namespace ROOT {
276 namespace Internal {
277  class TROOTAllocator {
278  // Simple wrapper to separate, time-wise, the call to the
279  // TROOT destructor and the actual free-ing of the memory.
280  //
281  // Since the interpreter implementation (currently TCling) is
282  // loaded via dlopen by libCore, the destruction of its global
283  // variable (i.e. in particular clang's) is scheduled before
284  // those in libCore so we need to schedule the call to the TROOT
285  // destructor before that *but* we want to make sure the memory
286  // stay around until libCore itself is unloaded so that code
287  // using gROOT can 'properly' check for validity.
288  //
289  // The order of loading for is:
290  // libCore.so
291  // libRint.so
292  // ... anything other library hard linked to the executable ...
293  // ... for example libEvent
294  // libCling.so
295  // ... other libraries like libTree for example ....
296  // and the destruction order is (of course) the reverse.
297  // By default the unloading of the dictionary, does use
298  // the service of the interpreter ... which of course
299  // fails if libCling is already unloaded by that information
300  // has not been registered per se.
301  //
302  // To solve this problem, we now schedule the destruction
303  // of the TROOT object to happen _just_ before the
304  // unloading/destruction of libCling so that we can
305  // maximize the amount of clean-up we can do correctly
306  // and we can still allocate the TROOT object's memory
307  // statically.
308  //
309  char fHolder[sizeof(TROOT)];
310  public:
311  TROOTAllocator() {
312  new(&(fHolder[0])) TROOT("root", "The ROOT of EVERYTHING");
313  }
314 
315  ~TROOTAllocator() {
316  if (gROOTLocal) {
317  gROOTLocal->~TROOT();
318  }
319  }
320  };
321 
322  // The global gROOT is defined to be a function (ROOT::GetROOT())
323  // which itself is dereferencing a function pointer.
324 
325  // Initially this function pointer's value is & GetROOT1 whose role is to
326  // create and initialize the TROOT object itself.
327  // At the very end of the TROOT constructor the value of the function pointer
328  // is switch to & GetROOT2 whose role is to initialize the interpreter.
329 
330  // This mechanism was primarily intended to fix the issues with order in which
331  // global TROOT and LLVM globals are initialized. TROOT was initializing
332  // Cling, but Cling could not be used yet due to LLVM globals not being
333  // initialized yet. The solution is to delay initializing the interpreter in
334  // TROOT till after main() when all LLVM globals are initialized.
335 
336  // Technically, the mechanism used actually delay the interpreter
337  // initialization until the first use of gROOT *after* the end of the
338  // TROOT constructor.
339 
340  // So to delay until after the start of main, we also made sure that none
341  // of the ROOT code (mostly the dictionary code) used during library loading
342  // is using gROOT (directly or indirectly).
343 
344  // In practice, the initialization of the interpreter is now delayed until
345  // the first use gROOT (or gInterpreter) after the start of main (but user
346  // could easily break this by using gROOT in their library initialization
347  // code).
348 
349  extern TROOT *gROOTLocal;
350 
352  if (gROOTLocal)
353  return gROOTLocal;
354  static TROOTAllocator alloc;
355  return gROOTLocal;
356  }
357 
359  static Bool_t initInterpreter = kFALSE;
360  if (!initInterpreter) {
361  initInterpreter = kTRUE;
363  // Load and init threads library
365  }
366  return gROOTLocal;
367  }
368  typedef TROOT *(*GetROOTFun_t)();
369 
371 
372  static Func_t GetSymInLibThread(const char *funcname)
373  {
374  const static bool loadSuccess = 0 <= gSystem->Load("libThread");
375  if (loadSuccess) {
376  if (auto sym = gSystem->DynFindSymbol(nullptr, funcname)) {
377  return sym;
378  } else {
379  Error("GetSymInLibThread", "Cannot get symbol %s.", funcname);
380  }
381  }
382  return nullptr;
383  }
384 
385 } // end of Internal sub namespace
386 // back to ROOT namespace
387 
389  return (*Internal::gGetROOT)();
390  }
391 
393  static TString macroPath;
394  return macroPath;
395  }
396 
397  ////////////////////////////////////////////////////////////////////////////////
398  /// Enables the global mutex to make ROOT thread safe/aware.
400  {
401  static void (*sym)() = (void(*)())Internal::GetSymInLibThread("ROOT_TThread_Initialize");
402  if (sym)
403  sym();
404  }
405 
406  ////////////////////////////////////////////////////////////////////////////////
407  /// Globally enables the implicit multi-threading in ROOT, activating the
408  /// parallel execution of those methods in ROOT that provide an internal
409  /// parallelisation.
410  /// The 'numthreads' parameter allows to control the number of threads to
411  /// be used by the implicit multi-threading. However, this parameter is just
412  /// a hint for ROOT, which will try to satisfy the request if the execution
413  /// scenario allows it. For example, if ROOT is configured to use an external
414  /// scheduler, setting a value for 'numthreads' might not have any effect.
415  /// @param[in] numthreads Number of threads to use. If not specified or
416  /// set to zero, the number of threads is automatically
417  /// decided by the implementation. Any other value is
418  /// used as a hint.
419  void EnableImplicitMT(UInt_t numthreads)
420  {
421  static void (*sym)(UInt_t) = (void(*)(UInt_t))Internal::GetSymInLibThread("ROOT_TImplicitMT_EnableImplicitMT");
422  if (sym)
423  sym(numthreads);
424  }
425 
426  ////////////////////////////////////////////////////////////////////////////////
427  /// Disables the implicit multi-threading in ROOT.
429  {
430  static void (*sym)() = (void(*)())Internal::GetSymInLibThread("ROOT_TImplicitMT_DisableImplicitMT");
431  if (sym)
432  sym();
433  }
434 
435  ////////////////////////////////////////////////////////////////////////////////
436  /// Returns true if the implicit multi-threading in ROOT is enabled.
438  {
439  static Bool_t (*sym)() = (Bool_t(*)())Internal::GetSymInLibThread("ROOT_TImplicitMT_IsImplicitMTEnabled");
440  if (sym)
441  return sym();
442  else
443  return kFALSE;
444  }
445 
446 }
447 
449 
450 // Global debug flag (set to > 0 to get debug output).
451 // Can be set either via the interpreter (gDebug is exported to CINT),
452 // via the rootrc resource "Root.Debug", via the shell environment variable
453 // ROOTDEBUG, or via the debugger.
455 
456 
458 
459 ////////////////////////////////////////////////////////////////////////////////
460 /// Default ctor.
461 
462 TROOT::TROOT() : TDirectory(),
463  fLineIsProcessing(0), fVersion(0), fVersionInt(0), fVersionCode(0),
464  fVersionDate(0), fVersionTime(0), fBuiltDate(0), fBuiltTime(0),
465  fTimer(0), fApplication(0), fInterpreter(0), fBatch(kTRUE), fEditHistograms(kTRUE),
466  fFromPopUp(kTRUE),fMustClean(kTRUE),fReadingObject(kFALSE),fForceStyle(kFALSE),
467  fInterrupt(kFALSE),fEscape(kFALSE),fExecutingMacro(kFALSE),fEditorMode(0),
468  fPrimitive(0),fSelectPad(0),fClasses(0),fTypes(0),fGlobals(0),fGlobalFunctions(0),
469  fClosedObjects(0),fFiles(0),fMappedFiles(0),fSockets(0),fCanvases(0),fStyles(0),fFunctions(0),
470  fTasks(0),fColors(0),fGeometries(0),fBrowsers(0),fSpecials(0),fCleanups(0),
471  fMessageHandlers(0),fStreamerInfo(0),fClassGenerators(0),fSecContexts(0),
472  fProofs(0),fClipboard(0),fDataSets(0),fUUIDs(0),fRootFolder(0),fBrowsables(0),
473  fPluginManager(0)
474 {
475 }
476 
477 ////////////////////////////////////////////////////////////////////////////////
478 /// Initialize the ROOT system. The creation of the TROOT object initializes
479 /// the ROOT system. It must be the first ROOT related action that is
480 /// performed by a program. The TROOT object must be created on the stack
481 /// (can not be called via new since "operator new" is protected). The
482 /// TROOT object is either created as a global object (outside the main()
483 /// program), or it is one of the first objects created in main().
484 /// Make sure that the TROOT object stays in scope for as long as ROOT
485 /// related actions are performed. TROOT is a so called singleton so
486 /// only one instance of it can be created. The single TROOT object can
487 /// always be accessed via the global pointer gROOT.
488 /// The name and title arguments can be used to identify the running
489 /// application. The initfunc argument can contain an array of
490 /// function pointers (last element must be 0). These functions are
491 /// executed at the end of the constructor. This way one can easily
492 /// extend the ROOT system without adding permanent dependencies
493 /// (e.g. the graphics system is initialized via such a function).
494 
495 TROOT::TROOT(const char *name, const char *title, VoidFuncPtr_t *initfunc)
496  : TDirectory(), fLineIsProcessing(0), fVersion(0), fVersionInt(0), fVersionCode(0),
497  fVersionDate(0), fVersionTime(0), fBuiltDate(0), fBuiltTime(0),
498  fTimer(0), fApplication(0), fInterpreter(0), fBatch(kTRUE), fEditHistograms(kTRUE),
499  fFromPopUp(kTRUE),fMustClean(kTRUE),fReadingObject(kFALSE),fForceStyle(kFALSE),
500  fInterrupt(kFALSE),fEscape(kFALSE),fExecutingMacro(kFALSE),fEditorMode(0),
501  fPrimitive(0),fSelectPad(0),fClasses(0),fTypes(0),fGlobals(0),fGlobalFunctions(0),
502  fClosedObjects(0),fFiles(0),fMappedFiles(0),fSockets(0),fCanvases(0),fStyles(0),fFunctions(0),
503  fTasks(0),fColors(0),fGeometries(0),fBrowsers(0),fSpecials(0),fCleanups(0),
504  fMessageHandlers(0),fStreamerInfo(0),fClassGenerators(0),fSecContexts(0),
505  fProofs(0),fClipboard(0),fDataSets(0),fUUIDs(0),fRootFolder(0),fBrowsables(0),
506  fPluginManager(0)
507 {
509  //Warning("TROOT", "only one instance of TROOT allowed");
510  return;
511  }
512 
514 
516  gDirectory = 0;
517 
518  // initialize gClassTable is not already done
519  if (!gClassTable) new TClassTable;
520 
521  SetName(name);
522  SetTitle(title);
523 
524  // will be used by global "operator delete" so make sure it is set
525  // before anything is deleted
526  fMappedFiles = 0;
527 
528  // create already here, but only initialize it after gEnv has been created
530 
531  // Initialize Operating System interface
532  InitSystem();
533 
535 
536  // Initialize interface to CINT C++ interpreter
537  fVersionInt = 0; // check in TROOT dtor in case TCling fails
538  fClasses = 0; // might be checked via TCling ctor
539  fEnums = 0;
540 
541  fConfigOptions = R__CONFIGUREOPTIONS;
542  fConfigFeatures = R__CONFIGUREFEATURES;
545  fVersionInt = IVERSQ();
548  fBuiltDate = IDATQQ(__DATE__);
549  fBuiltTime = ITIMQQ(__TIME__);
550 
551  ReadGitInfo();
552 
553  fClasses = new THashTable(800,3);
554  //fIdMap = new IdMap_t;
555  fStreamerInfo = new TObjArray(100);
556  fClassGenerators = new TList;
557 
558  // usedToIdentifyRootClingByDlSym is available when TROOT is part of
559  // rootcling.
560  if (!dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")) {
561  // initialize plugin manager early
563 #if defined(R__MACOSX) && (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
564  if (TARGET_OS_IPHONE | TARGET_IPHONE_SIMULATOR) {
565  TEnv plugins(".plugins-ios");
567  }
568 #endif
569  }
570 
572 
573  fTimer = 0;
574  fApplication = 0;
575  fColors = new TObjArray(1000); fColors->SetName("ListOfColors");
576  fTypes = 0;
577  fGlobals = 0;
578  fGlobalFunctions = 0;
579  // fList was created in TDirectory::Build but with different sizing.
580  delete fList;
581  fList = new THashList(1000,3);
582  fClosedObjects = new TList; fClosedObjects->SetName("ClosedFiles");
583  fFiles = new TList; fFiles->SetName("Files");
584  fMappedFiles = new TList; fMappedFiles->SetName("MappedFiles");
585  fSockets = new TList; fSockets->SetName("Sockets");
586  fCanvases = new TList; fCanvases->SetName("Canvases");
587  fStyles = new TList; fStyles->SetName("Styles");
588  fFunctions = new TList; fFunctions->SetName("Functions");
589  fTasks = new TList; fTasks->SetName("Tasks");
590  fGeometries = new TList; fGeometries->SetName("Geometries");
591  fBrowsers = new TList; fBrowsers->SetName("Browsers");
592  fSpecials = new TList; fSpecials->SetName("Specials");
593  fBrowsables = new TList; fBrowsables->SetName("Browsables");
594  fCleanups = new THashList; fCleanups->SetName("Cleanups");
595  fMessageHandlers = new TList; fMessageHandlers->SetName("MessageHandlers");
596  fSecContexts = new TList; fSecContexts->SetName("SecContexts");
597  fProofs = new TList; fProofs->SetName("Proofs");
598  fClipboard = new TList; fClipboard->SetName("Clipboard");
599  fDataSets = new TList; fDataSets->SetName("DataSets");
600  fTypes = new TListOfTypes;
601 
603  fUUIDs = new TProcessUUID();
604 
605  fRootFolder = new TFolder();
606  fRootFolder->SetName("root");
607  fRootFolder->SetTitle("root of all folders");
608  fRootFolder->AddFolder("Classes", "List of Active Classes",fClasses);
609  fRootFolder->AddFolder("Colors", "List of Active Colors",fColors);
610  fRootFolder->AddFolder("MapFiles", "List of MapFiles",fMappedFiles);
611  fRootFolder->AddFolder("Sockets", "List of Socket Connections",fSockets);
612  fRootFolder->AddFolder("Canvases", "List of Canvases",fCanvases);
613  fRootFolder->AddFolder("Styles", "List of Styles",fStyles);
614  fRootFolder->AddFolder("Functions", "List of Functions",fFunctions);
615  fRootFolder->AddFolder("Tasks", "List of Tasks",fTasks);
616  fRootFolder->AddFolder("Geometries","List of Geometries",fGeometries);
617  fRootFolder->AddFolder("Browsers", "List of Browsers",fBrowsers);
618  fRootFolder->AddFolder("Specials", "List of Special Objects",fSpecials);
619  fRootFolder->AddFolder("Handlers", "List of Message Handlers",fMessageHandlers);
620  fRootFolder->AddFolder("Cleanups", "List of RecursiveRemove Collections",fCleanups);
621  fRootFolder->AddFolder("StreamerInfo","List of Active StreamerInfo Classes",fStreamerInfo);
622  fRootFolder->AddFolder("SecContexts","List of Security Contexts",fSecContexts);
623  fRootFolder->AddFolder("PROOF Sessions", "List of PROOF sessions",fProofs);
624  fRootFolder->AddFolder("ROOT Memory","List of Objects in the gROOT Directory",fList);
625  fRootFolder->AddFolder("ROOT Files","List of Connected ROOT Files",fFiles);
626 
627  // by default, add the list of files, tasks, canvases and browsers in the Cleanups list
633 
636  fFromPopUp = kFALSE;
638  fInterrupt = kFALSE;
639  fEscape = kFALSE;
640  fMustClean = kTRUE;
641  fPrimitive = 0;
642  fSelectPad = 0;
643  fEditorMode = 0;
644  fDefCanvasName = "c1";
646  fLineIsProcessing = 1; // This prevents WIN32 "Windows" thread to pick ROOT objects with mouse
647  gDirectory = this;
648  gPad = 0;
649 
650  //set name of graphical cut class for the graphics editor
651  //cannot call SetCutClassName at this point because the TClass of TCutG
652  //is not yet build
653  fCutClassName = "TCutG";
654 
655  // Create a default MessageHandler
656  new TMessageHandler((TClass*)0);
657 
658  // Create some styles
659  gStyle = 0;
661  SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
662 
663  // Setup default (batch) graphics and GUI environment
666  gGXBatch = new TVirtualX("Batch", "ROOT Interface to batch graphics");
668 
669 #if defined(R__WIN32)
670  fBatch = kFALSE;
671 #elif defined(R__HAS_COCOA)
672  fBatch = kFALSE;
673 #else
674  if (gSystem->Getenv("DISPLAY"))
675  fBatch = kFALSE;
676  else
677  fBatch = kTRUE;
678 #endif
679 
680  int i = 0;
681  while (initfunc && initfunc[i]) {
682  (initfunc[i])();
683  fBatch = kFALSE; // put system in graphics mode (backward compatible)
684  i++;
685  }
686 
687  // Set initial/default list of browsable objects
688  fBrowsables->Add(fRootFolder, "root");
689  fBrowsables->Add(fProofs, "PROOF Sessions");
690  fBrowsables->Add(workdir, gSystem->WorkingDirectory());
691  fBrowsables->Add(fFiles, "ROOT Files");
692 
693  atexit(CleanUpROOTAtExit);
694 
696 }
697 
698 ////////////////////////////////////////////////////////////////////////////////
699 /// Clean up and free resources used by ROOT (files, network sockets,
700 /// shared memory segments, etc.).
701 
703 {
704  using namespace ROOT::Internal;
705 
706  if (gROOTLocal == this) {
707 
708  // If the interpreter has not yet been initialized, don't bother
709  gGetROOT = &GetROOT1;
710 
711  // Mark the object as invalid, so that we can veto some actions
712  // (like autoloading) while we are in the destructor.
714 
715  // Turn-off the global mutex to avoid recreating mutexes that have
716  // already been deleted during the destruction phase
717  gGlobalMutex = 0;
718 
719  // Return when error occurred in TCling, i.e. when setup file(s) are
720  // out of date
721  if (!fVersionInt) return;
722 
723  // ATTENTION!!! Order is important!
724 
725 #ifdef R__COMPLETE_MEM_TERMINATION
728  fSpecials->Delete(); SafeDelete(fSpecials); // delete special objects : PostScript, Minuit, Html
729 #endif
730  fClosedObjects->Delete("slow"); // and closed files
731  fFiles->Delete("slow"); // and files
733  fSecContexts->Delete("slow"); SafeDelete(fSecContexts); // and security contexts
734  fSockets->Delete(); SafeDelete(fSockets); // and sockets
735  fMappedFiles->Delete("slow"); // and mapped files
736  delete fUUIDs;
737  TProcessID::Cleanup(); // and list of ProcessIDs
738  TSeqCollection *tl = fMappedFiles; fMappedFiles = 0; delete tl;
739 
741 
742  fFunctions->Delete(); SafeDelete(fFunctions); // etc..
745 #ifdef R__COMPLETE_MEM_TERMINATION
747 #endif
750 
751 #ifdef R__COMPLETE_MEM_TERMINATION
756 #endif
757 
758  // Stop emitting signals
760 
762 
763 #ifdef R__COMPLETE_MEM_TERMINATION
769 
770  fCleanups->Clear();
772  delete gClassTable; gClassTable = 0;
773  delete gEnv; gEnv = 0;
774 
775  if (fTypes) fTypes->Delete();
777  if (fGlobals) fGlobals->Delete();
781  fEnums->Delete();
782  fClasses->Delete(); SafeDelete(fClasses); // TClass'es must be deleted last
783 #endif
784 
785  // Remove shared libraries produced by the TSystem::CompileMacro() call
787 
788  // Cleanup system class
789  delete gSystem;
790 
791  // ROOT-6022:
792  // if (gInterpreterLib) dlclose(gInterpreterLib);
793 #ifdef R__COMPLETE_MEM_TERMINATION
794  // On some 'newer' platform (Fedora Core 17+, Ubuntu 12), the
795  // initialization order is (by default?) is 'wrong' and so we can't
796  // delete the interpreter now .. because any of the static in the
797  // interpreter's library have already been deleted.
798  // On the link line, we must list the most dependent .o file
799  // and end with the least dependent (LLVM libraries), unfortunately,
800  // Fedora Core 17+ or Ubuntu 12 will also execute the initialization
801  // in the same order (hence doing libCore's before LLVM's and
802  // vice et versa for both the destructor. We worked around the
803  // initialization order by delay the TROOT creation until first use.
804  // We can not do the same for destruction as we have no way of knowing
805  // the last access ...
806  // So for now, let's avoid delete TCling except in the special build
807  // checking the completeness of the termination deletion.
808  gDestroyCling(fInterpreter);
809 #endif
810 
811 #ifdef R__COMPLETE_MEM_TERMINATION
813 #endif
814 
815  // Prints memory stats
817 
818  gROOTLocal = 0;
819  fgRootInit = kFALSE;
820  }
821 }
822 
823 ////////////////////////////////////////////////////////////////////////////////
824 /// Add a class to the list and map of classes.
825 /// This routine is deprecated, use TClass::AddClass directly.
826 
828 {
829  TClass::AddClass(cl);
830 }
831 
832 ////////////////////////////////////////////////////////////////////////////////
833 /// Add a class generator. This generator will be called by TClass::GetClass
834 /// in case its does not find a loaded rootcint dictionary to request the
835 /// creation of a TClass object.
836 
838 {
839  if (!generator) return;
840  fClassGenerators->Add(generator);
841 }
842 
843 ////////////////////////////////////////////////////////////////////////////////
844 /// Add browsable objects to TBrowser.
845 
847 {
848  TObject *obj;
850 
851  while ((obj = (TObject *) next())) {
852  const char *opt = next.GetOption();
853  if (opt && strlen(opt))
854  b->Add(obj, opt);
855  else
856  b->Add(obj, obj->GetName());
857  }
858 }
859 
860 ////////////////////////////////////////////////////////////////////////////////
861 /// return class status bit kClassSaved for class cl
862 /// This function is called by the SavePrimitive functions writing
863 /// the C++ code for an object.
864 
866 {
867  if (cl == 0) return kFALSE;
868  if (cl->TestBit(TClass::kClassSaved)) return kTRUE;
870  return kFALSE;
871 }
872 
873 namespace {
874  static void R__ListSlowClose(TList *files)
875  {
876  // Routine to close a list of files using the 'slow' techniques
877  // that also for the deletion ot update the list itself.
878 
879  static TObject harmless;
880  TObjLink *cursor = files->FirstLink();
881  while (cursor) {
882  TDirectory *dir = static_cast<TDirectory*>( cursor->GetObject() );
883  if (dir) {
884  // In order for the iterator to stay valid, we must
885  // prevent the removal of the object (dir) from the list
886  // (which is done in TFile::Close). We can also can not
887  // just move to the next iterator since the Close might
888  // also (indirectly) remove that file.
889  // So we SetObject to a harmless value, so that 'dir'
890  // is not seen as part of the list.
891  // We will later, remove all the object (see files->Clear()
892  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
893  dir->Close();
894  // Put it back
895  cursor->SetObject(dir);
896  }
897  cursor = cursor->Next();
898  };
899  // Now were done, clear the list but do not delete the objects as
900  // they have been moved to the list of closed objects and must be
901  // deleted from there in order to avoid a double delete from a
902  // use objects (on the interpreter stack).
903  files->Clear("nodelete");
904  }
905 }
906 
907 ////////////////////////////////////////////////////////////////////////////////
908 /// Close any files and sockets that gROOT knows about.
909 /// This can be used to insures that the files and sockets are closed before any library is unloaded!
910 
912 {
913  if (fFiles && fFiles->First()) {
914  R__ListSlowClose(static_cast<TList*>(fFiles));
915  }
916  // and Close TROOT itself.
917  Close();
918  // Now sockets.
919  if (fSockets && fSockets->First()) {
920  if (0==fCleanups->FindObject(fSockets) ) {
923  }
924  CallFunc_t *socketCloser = gInterpreter->CallFunc_Factory();
925  Long_t offset = 0;
926  TClass *socketClass = TClass::GetClass("TSocket");
927  gInterpreter->CallFunc_SetFuncProto(socketCloser, socketClass->GetClassInfo(), "Close", "", &offset);
928  if (gInterpreter->CallFunc_IsValid(socketCloser)) {
929  static TObject harmless;
930  TObjLink *cursor = static_cast<TList*>(fSockets)->FirstLink();
931  TList notclosed;
932  while (cursor) {
933  TObject *socket = cursor->GetObject();
934  // In order for the iterator to stay valid, we must
935  // prevent the removal of the object (dir) from the list
936  // (which is done in TFile::Close). We can also can not
937  // just move to the next iterator since the Close might
938  // also (indirectly) remove that file.
939  // So we SetObject to a harmless value, so that 'dir'
940  // is not seen as part of the list.
941  // We will later, remove all the object (see files->Clear()
942  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
943 
944  if (socket->IsA()->InheritsFrom(socketClass)) {
945  gInterpreter->CallFunc_Exec(socketCloser, ((char*)socket)+offset);
946  // Put the object in the closed list for later deletion.
947  socket->SetBit(kMustCleanup);
948  fClosedObjects->AddLast(socket);
949  } else {
950  // Crap ... this is not a socket, likely Proof or something, let's try to find a Close
951  Long_t other_offset;
952  CallFunc_t *otherCloser = gInterpreter->CallFunc_Factory();
953  gInterpreter->CallFunc_SetFuncProto(otherCloser, socket->IsA()->GetClassInfo(), "Close", "", &other_offset);
954  if (gInterpreter->CallFunc_IsValid(otherCloser)) {
955  gInterpreter->CallFunc_Exec(otherCloser, ((char*)socket)+other_offset);
956  // Put the object in the closed list for later deletion.
957  socket->SetBit(kMustCleanup);
958  fClosedObjects->AddLast(socket);
959  } else {
960  notclosed.AddLast(socket);
961  }
962  gInterpreter->CallFunc_Delete(otherCloser);
963  // Put it back
964  cursor->SetObject(socket);
965  }
966  cursor = cursor->Next();
967  }
968  // Now were done, clear the list
969  fSockets->Clear();
970  // Read the one we did not close
971  cursor = notclosed.FirstLink();
972  while (cursor) {
973  static_cast<TList*>(fSockets)->AddLast(cursor->GetObject());
974  cursor = cursor->Next();
975  }
976  }
977  gInterpreter->CallFunc_Delete(socketCloser);
978  }
979  if (fMappedFiles && fMappedFiles->First()) {
980  R__ListSlowClose(static_cast<TList*>(fMappedFiles));
981  }
982 
983 }
984 
985 ////////////////////////////////////////////////////////////////////////////////
986 /// Execute the cleanups necessary at the end of the process, in particular
987 /// those that must be executed before the library start being unloaded.
988 
990 {
991  CloseFiles();
992 
993  if (gInterpreter) {
994  gInterpreter->ResetGlobals();
995  }
996 
997  // Now a set of simpler things to delete. See the same ordering in
998  // TROOT::~TROOT
999  fFunctions->Delete();
1000  fGeometries->Delete();
1001  fBrowsers->Delete();
1002  fCanvases->Delete();
1003  fColors->Delete();
1004  fStyles->Delete();
1005 }
1006 
1007 
1008 ////////////////////////////////////////////////////////////////////////////////
1009 /// Find an object in one Root folder
1010 
1012 {
1013  Error("FindObject","Not yet implemented");
1014  return 0;
1015 }
1016 
1017 ////////////////////////////////////////////////////////////////////////////////
1018 /// Returns address of a ROOT object if it exists
1019 ///
1020 /// If name contains at least one "/" the function calls FindObjectany
1021 /// else
1022 /// This function looks in the following order in the ROOT lists:
1023 /// - List of files
1024 /// - List of memory mapped files
1025 /// - List of functions
1026 /// - List of geometries
1027 /// - List of canvases
1028 /// - List of styles
1029 /// - List of specials
1030 /// - List of materials in current geometry
1031 /// - List of shapes in current geometry
1032 /// - List of matrices in current geometry
1033 /// - List of Nodes in current geometry
1034 /// - Current Directory in memory
1035 /// - Current Directory on file
1036 
1037 TObject *TROOT::FindObject(const char *name) const
1038 {
1039  if (name && strstr(name,"/")) return FindObjectAny(name);
1040 
1041  TObject *temp = 0;
1042 
1043  temp = fFiles->FindObject(name); if (temp) return temp;
1044  temp = fMappedFiles->FindObject(name); if (temp) return temp;
1045  {
1047  temp = fFunctions->FindObject(name); if (temp) return temp;
1048  }
1049  temp = fGeometries->FindObject(name); if (temp) return temp;
1050  temp = fCanvases->FindObject(name); if (temp) return temp;
1051  temp = fStyles->FindObject(name); if (temp) return temp;
1052  temp = fSpecials->FindObject(name); if (temp) return temp;
1054  TObject *obj;
1055  while ((obj=next())) {
1056  temp = obj->FindObject(name); if (temp) return temp;
1057  }
1058  if (gDirectory) temp = gDirectory->Get(name); if (temp) return temp;
1059  if (gPad) {
1060  TVirtualPad *canvas = gPad->GetVirtCanvas();
1061  if (fCanvases->FindObject(canvas)) { //this check in case call from TCanvas ctor
1062  temp = canvas->FindObject(name);
1063  if (!temp && canvas != gPad) temp = gPad->FindObject(name);
1064  }
1065  }
1066  return temp;
1067 }
1068 
1069 ////////////////////////////////////////////////////////////////////////////////
1070 /// Returns address and folder of a ROOT object if it exists
1071 ///
1072 /// This function looks in the following order in the ROOT lists:
1073 /// - List of files
1074 /// - List of memory mapped files
1075 /// - List of functions
1076 /// - List of geometries
1077 /// - List of canvases
1078 /// - List of styles
1079 /// - List of specials
1080 /// - List of materials in current geometry
1081 /// - List of shapes in current geometry
1082 /// - List of matrices in current geometry
1083 /// - List of Nodes in current geometry
1084 /// - Current Directory in memory
1085 /// - Current Directory on file
1086 
1087 TObject *TROOT::FindSpecialObject(const char *name, void *&where)
1088 {
1089  TObject *temp = 0;
1090  where = 0;
1091 
1092  if (!temp) {
1093  temp = fFiles->FindObject(name);
1094  where = fFiles;
1095  }
1096  if (!temp) {
1097  temp = fMappedFiles->FindObject(name);
1098  where = fMappedFiles;
1099  }
1100  if (!temp) {
1102  temp = fFunctions->FindObject(name);
1103  where = fFunctions;
1104  }
1105  if (!temp) {
1106  temp = fCanvases->FindObject(name);
1107  where = fCanvases;
1108  }
1109  if (!temp) {
1110  temp = fStyles->FindObject(name);
1111  where = fStyles;
1112  }
1113  if (!temp) {
1114  temp = fSpecials->FindObject(name);
1115  where = fSpecials;
1116  }
1117  if (!temp) {
1118  TObject *glast = fGeometries->Last();
1119  if (glast) {where = glast; temp = glast->FindObject(name);}
1120  }
1121  if (!temp && gDirectory) {
1122  temp = gDirectory->Get(name);
1123  where = gDirectory;
1124  }
1125  if (!temp && gPad) {
1126  TVirtualPad *canvas = gPad->GetVirtCanvas();
1127  if (fCanvases->FindObject(canvas)) { //this check in case call from TCanvas ctor
1128  temp = canvas->FindObject(name);
1129  where = canvas;
1130  if (!temp && canvas != gPad) {
1131  temp = gPad->FindObject(name);
1132  where = gPad;
1133  }
1134  }
1135  }
1136  if (!temp) return 0;
1137  if (temp->TestBit(kNotDeleted)) return temp;
1138  return 0;
1139 }
1140 
1141 ////////////////////////////////////////////////////////////////////////////////
1142 /// Return a pointer to the first object with name starting at //root.
1143 /// This function scans the list of all folders.
1144 /// if no object found in folders, it scans the memory list of all files.
1145 
1146 TObject *TROOT::FindObjectAny(const char *name) const
1147 {
1149  if (obj) return obj;
1150  return gDirectory->FindObjectAnyFile(name);
1151 }
1152 
1153 ////////////////////////////////////////////////////////////////////////////////
1154 /// Scan the memory lists of all files for an object with name
1155 
1157 {
1159  TDirectory *d;
1161  while ((d = (TDirectory*)next())) {
1162  // Call explicitly TDirectory::FindObject to restrict the search to the
1163  // already in memory object.
1164  TObject *obj = d->TDirectory::FindObject(name);
1165  if (obj) return obj;
1166  }
1167  return 0;
1168 }
1169 
1170 ////////////////////////////////////////////////////////////////////////////////
1171 /// Returns class name of a ROOT object including CINT globals.
1172 
1173 const char *TROOT::FindObjectClassName(const char *name) const
1174 {
1175  // Search first in the list of "standard" objects
1176  TObject *obj = FindObject(name);
1177  if (obj) return obj->ClassName();
1178 
1179  // Is it a global variable?
1180  TGlobal *g = GetGlobal(name);
1181  if (g) return g->GetTypeName();
1182 
1183  return 0;
1184 }
1185 
1186 ////////////////////////////////////////////////////////////////////////////////
1187 /// Return path name of obj somewhere in the //root/... path.
1188 /// The function returns the first occurence of the object in the list
1189 /// of folders. The returned string points to a static char array in TROOT.
1190 /// If this function is called in a loop or recursively, it is the
1191 /// user's responsibility to copy this string in their area.
1192 
1193 const char *TROOT::FindObjectPathName(const TObject *) const
1194 {
1195  Error("FindObjectPathName","Not yet implemented");
1196  return "??";
1197 }
1198 
1199 ////////////////////////////////////////////////////////////////////////////////
1200 /// return a TClass object corresponding to 'name' assuming it is an STL container.
1201 /// In particular we looking for possible alternative name (default template
1202 /// parameter, typedefs template arguments, typedefed name).
1203 
1204 TClass *TROOT::FindSTLClass(const char *name, Bool_t load, Bool_t silent) const
1205 {
1206  // Example of inputs are
1207  // vector<int> (*)
1208  // vector<Int_t>
1209  // vector<long long>
1210  // vector<Long_64_t> (*)
1211  // vector<int, allocator<int> >
1212  // vector<Int_t, allocator<int> >
1213  //
1214  // One of the possibly expensive operation is the resolving of the typedef
1215  // which can provoke the parsing of the header files (and/or the loading
1216  // of clang pcms information).
1217 
1219 
1220  // Remove std::, allocator, typedef, add Long64_t, etc. in just one call.
1221  std::string normalized;
1222  TClassEdit::GetNormalizedName(normalized, name);
1223 
1224  TClass *cl = 0;
1225  if (normalized != name) cl = TClass::GetClass(normalized.c_str(),load,silent);
1226 
1227  if (load && cl==0) {
1228  // Create an Emulated class for this container.
1229  cl = gInterpreter->GenerateTClass(normalized.c_str(), kTRUE, silent);
1230  }
1231 
1232  return cl;
1233 }
1234 
1235 ////////////////////////////////////////////////////////////////////////////////
1236 /// Return pointer to class with name. Obsolete, use TClass::GetClass directly
1237 
1238 TClass *TROOT::GetClass(const char *name, Bool_t load, Bool_t silent) const
1239 {
1240  return TClass::GetClass(name,load,silent);
1241 }
1242 
1243 
1244 ////////////////////////////////////////////////////////////////////////////////
1245 /// Return pointer to class from its name. Obsolete, use TClass::GetClass directly
1246 /// See TClass::GetClass
1247 
1248 TClass *TROOT::GetClass(const type_info& typeinfo, Bool_t load, Bool_t silent) const
1249 {
1250  return TClass::GetClass(typeinfo,load,silent);
1251 }
1252 
1253 ////////////////////////////////////////////////////////////////////////////////
1254 /// Return address of color with index color.
1255 
1257 {
1259  TObjArray *lcolors = (TObjArray*) GetListOfColors();
1260  if (!lcolors) return 0;
1261  if (color < 0 || color >= lcolors->GetSize()) return 0;
1262  TColor *col = (TColor*)lcolors->At(color);
1263  if (col && col->GetNumber() == color) return col;
1264  TIter next(lcolors);
1265  while ((col = (TColor *) next()))
1266  if (col->GetNumber() == color) return col;
1267 
1268  return 0;
1269 }
1270 
1271 ////////////////////////////////////////////////////////////////////////////////
1272 /// Return a default canvas.
1273 
1274 TCanvas *TROOT::MakeDefCanvas() const
1275 {
1276  return (TCanvas*)gROOT->ProcessLine("TCanvas::MakeDefCanvas();");
1277 }
1278 
1279 ////////////////////////////////////////////////////////////////////////////////
1280 /// Return pointer to type with name.
1281 
1282 TDataType *TROOT::GetType(const char *name, Bool_t /* load */) const
1283 {
1284  return (TDataType*)gROOT->GetListOfTypes()->FindObject(name);
1285 }
1286 
1287 ////////////////////////////////////////////////////////////////////////////////
1288 /// Return pointer to file with name.
1289 
1290 TFile *TROOT::GetFile(const char *name) const
1291 {
1293  return (TFile*)GetListOfFiles()->FindObject(name);
1294 }
1295 
1296 ////////////////////////////////////////////////////////////////////////////////
1297 /// Return pointer to style with name
1298 
1299 TStyle *TROOT::GetStyle(const char *name) const
1300 {
1301  return (TStyle*)GetListOfStyles()->FindObject(name);
1302 }
1303 
1304 ////////////////////////////////////////////////////////////////////////////////
1305 /// Return pointer to function with name.
1306 
1307 TObject *TROOT::GetFunction(const char *name) const
1308 {
1309  if (name == 0 || name[0] == 0) {
1310  return 0;
1311  }
1312 
1313  {
1315  TObject *f1 = fFunctions->FindObject(name);
1316  if (f1) return f1;
1317  }
1318 
1319  gROOT->ProcessLine("TF1::InitStandardFunctions();");
1320 
1322  return fFunctions->FindObject(name);
1323 }
1324 
1325 ////////////////////////////////////////////////////////////////////////////////
1326 
1328 {
1329  if (!gInterpreter) return 0;
1330 
1332 
1333  return (TFunctionTemplate*)fFuncTemplate->FindObject(name);
1334 }
1335 
1336 ////////////////////////////////////////////////////////////////////////////////
1337 /// Return pointer to global variable by name. If load is true force
1338 /// reading of all currently defined globals from CINT (more expensive).
1339 
1340 TGlobal *TROOT::GetGlobal(const char *name, Bool_t load) const
1341 {
1342  return (TGlobal *)gROOT->GetListOfGlobals(load)->FindObject(name);
1343 }
1344 
1345 ////////////////////////////////////////////////////////////////////////////////
1346 /// Return pointer to global variable with address addr.
1347 
1348 TGlobal *TROOT::GetGlobal(const TObject *addr, Bool_t /* load */) const
1349 {
1350  if (addr == 0 || ((Long_t)addr) == -1) return 0;
1351 
1352  TInterpreter::DeclId_t decl = gInterpreter->GetDataMemberAtAddr(addr);
1353  if (decl) {
1354  TListOfDataMembers *globals = ((TListOfDataMembers*)(gROOT->GetListOfGlobals(kFALSE)));
1355  return (TGlobal*)globals->Get(decl);
1356  }
1357  // If we are actually looking for a global that is held by a global
1358  // pointer (for example gRandom), we need to find a pointer with the
1359  // correct value.
1360  decl = gInterpreter->GetDataMemberWithValue(addr);
1361  if (decl) {
1362  TListOfDataMembers *globals = ((TListOfDataMembers*)(gROOT->GetListOfGlobals(kFALSE)));
1363  return (TGlobal*)globals->Get(decl);
1364  }
1365  return 0;
1366 }
1367 
1368 ////////////////////////////////////////////////////////////////////////////////
1369 /// Internal routine returning, and creating if necessary, the list
1370 /// of global function.
1371 
1373 {
1375  return fGlobalFunctions;
1376 }
1377 
1378 ////////////////////////////////////////////////////////////////////////////////
1379 /// Return the collection of functions named "name".
1380 
1382 {
1383  return ((TListOfFunctions*)fFunctions)->GetListForObject(name);
1384 }
1385 
1386 ////////////////////////////////////////////////////////////////////////////////
1387 /// Return pointer to global function by name.
1388 /// If params != 0 it will also resolve overloading other it returns the first
1389 /// name match.
1390 /// If params == 0 and load is true force reading of all currently defined
1391 /// global functions from Cling.
1392 /// The param string must be of the form: "3189,\"aap\",1.3".
1393 
1394 TFunction *TROOT::GetGlobalFunction(const char *function, const char *params,
1395  Bool_t load)
1396 {
1397  if (!params) {
1399  return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
1400  } else {
1401  if (!fInterpreter)
1402  Fatal("GetGlobalFunction", "fInterpreter not initialized");
1403 
1405  TInterpreter::DeclId_t decl = gInterpreter->GetFunctionWithValues(0,
1406  function, params,
1407  false);
1408 
1409  if (!decl) return 0;
1410 
1411  TFunction *f = GetGlobalFunctions()->Get(decl);
1412  if (f) return f;
1413 
1414  Error("GetGlobalFunction",
1415  "\nDid not find matching TFunction <%s> with \"%s\".",
1416  function,params);
1417  return 0;
1418  }
1419 }
1420 
1421 ////////////////////////////////////////////////////////////////////////////////
1422 /// Return pointer to global function by name. If proto != 0
1423 /// it will also resolve overloading. If load is true force reading
1424 /// of all currently defined global functions from CINT (more expensive).
1425 /// The proto string must be of the form: "int, char*, float".
1426 
1428  const char *proto, Bool_t load)
1429 {
1430  if (!proto) {
1432  return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
1433  } else {
1434  if (!fInterpreter)
1435  Fatal("GetGlobalFunctionWithPrototype", "fInterpreter not initialized");
1436 
1438  TInterpreter::DeclId_t decl = gInterpreter->GetFunctionWithPrototype(0,
1439  function, proto);
1440 
1441  if (!decl) return 0;
1442 
1443  TFunction *f = GetGlobalFunctions()->Get(decl);
1444  if (f) return f;
1445 
1446  Error("GetGlobalFunctionWithPrototype",
1447  "\nDid not find matching TFunction <%s> with \"%s\".",
1448  function,proto);
1449  return 0;
1450  }
1451 }
1452 
1453 ////////////////////////////////////////////////////////////////////////////////
1454 /// Return pointer to Geometry with name
1455 
1456 TObject *TROOT::GetGeometry(const char *name) const
1457 {
1458  return GetListOfGeometries()->FindObject(name);
1459 }
1460 
1461 ////////////////////////////////////////////////////////////////////////////////
1462 
1464 {
1465  if(!fEnums.load()) {
1467  // Test again just in case, another thread did the work while we were
1468  // waiting.
1469  if (!fEnums.load()) fEnums = new TListOfEnumsWithLock(0);
1470  }
1471  if (load) {
1473  (*fEnums).Load(); // Refresh the list of enums.
1474  }
1475  return fEnums.load();
1476 }
1477 
1478 ////////////////////////////////////////////////////////////////////////////////
1479 
1481 {
1483  if(!fFuncTemplate) {
1485  }
1486  return fFuncTemplate;
1487 }
1488 
1489 ////////////////////////////////////////////////////////////////////////////////
1490 /// Return list containing the TGlobals currently defined.
1491 /// Since globals are created and deleted during execution of the
1492 /// program, we need to update the list of globals every time we
1493 /// execute this method. However, when calling this function in
1494 /// a (tight) loop where no interpreter symbols will be created
1495 /// you can set load=kFALSE (default).
1496 
1498 {
1499  if (!fGlobals) {
1500  // We add to the list the "funcky-fake" globals.
1501  fGlobals = new TListOfDataMembers(0);
1502  fGlobals->Add(new TGlobalMappedFunction("gROOT", "TROOT*",
1504  fGlobals->Add(new TGlobalMappedFunction("gPad", "TVirtualPad*",
1506  fGlobals->Add(new TGlobalMappedFunction("gInterpreter", "TInterpreter*",
1508  fGlobals->Add(new TGlobalMappedFunction("gVirtualX", "TTVirtualX*",
1510  fGlobals->Add(new TGlobalMappedFunction("gDirectory", "TDirectory*",
1514  }
1515 
1516  if (!fInterpreter)
1517  Fatal("GetListOfGlobals", "fInterpreter not initialized");
1518 
1519  if (load) fGlobals->Load();
1520 
1521  return fGlobals;
1522 }
1523 
1524 ////////////////////////////////////////////////////////////////////////////////
1525 /// Return list containing the TFunctions currently defined.
1526 /// Since functions are created and deleted during execution of the
1527 /// program, we need to update the list of functions every time we
1528 /// execute this method. However, when calling this function in
1529 /// a (tight) loop where no interpreter symbols will be created
1530 /// you can set load=kFALSE (default).
1531 
1533 {
1535 
1536  if (!fGlobalFunctions) {
1538  }
1539 
1540  if (!fInterpreter)
1541  Fatal("GetListOfGlobalFunctions", "fInterpreter not initialized");
1542 
1543  // A thread that calls with load==true and a thread that calls with load==false
1544  // will conflict here (the load==true will be updating the list while the
1545  // other is reading it). To solve the problem, we could use a read-write lock
1546  // inside the list itself.
1547  if (load) fGlobalFunctions->Load();
1548 
1549  return fGlobalFunctions;
1550 }
1551 
1552 ////////////////////////////////////////////////////////////////////////////////
1553 /// Return a dynamic list giving access to all TDataTypes (typedefs)
1554 /// currently defined.
1555 ///
1556 /// The list is populated on demand. Calling
1557 /// ~~~ {.cpp}
1558 /// gROOT->GetListOfTypes()->FindObject(nameoftype);
1559 /// ~~~
1560 /// will return the TDataType corresponding to 'nameoftype'. If the
1561 /// TDataType is not already in the list itself and the type does exist,
1562 /// a new TDataType will be created and added to the list.
1563 ///
1564 /// Calling
1565 /// ~~~ {.cpp}
1566 /// gROOT->GetListOfTypes()->ls(); // or Print()
1567 /// ~~~
1568 /// list only the typedefs that have been previously accessed through the
1569 /// list (plus the builtins types).
1570 
1572 {
1573  if (!fInterpreter)
1574  Fatal("GetListOfTypes", "fInterpreter not initialized");
1575 
1576  return fTypes;
1577 }
1578 
1579 
1580 ////////////////////////////////////////////////////////////////////////////////
1581 /// Execute command when system has been idle for idleTimeInSec seconds.
1582 
1583 void TROOT::Idle(UInt_t idleTimeInSec, const char *command)
1584 {
1585  if (!fApplication.load())
1587 
1588  if (idleTimeInSec <= 0)
1589  (*fApplication).RemoveIdleTimer();
1590  else
1591  (*fApplication).SetIdleTimer(idleTimeInSec, command);
1592 }
1593 
1594 ////////////////////////////////////////////////////////////////////////////////
1595 /// Check whether className is a known class, and only autoload
1596 /// if we can. Helper function for TROOT::IgnoreInclude().
1597 
1598 static TClass* R__GetClassIfKnown(const char* className)
1599 {
1600  // Check whether the class is available for auto-loading first:
1601  const char* libsToLoad = gInterpreter->GetClassSharedLibs(className);
1602  TClass* cla = 0;
1603  if (libsToLoad) {
1604  // trigger autoload, and only create TClass in this case.
1605  return TClass::GetClass(className);
1606  } else if (gROOT->GetListOfClasses()
1607  && (cla = (TClass*)gROOT->GetListOfClasses()->FindObject(className))) {
1608  // cla assigned in if statement
1609  } else if (gClassTable->FindObject(className)) {
1610  return TClass::GetClass(className);
1611  }
1612  return cla;
1613 }
1614 
1615 ////////////////////////////////////////////////////////////////////////////////
1616 /// Return 1 if the name of the given include file corresponds to a class that
1617 /// is known to ROOT, e.g. "TLorentzVector.h" versus TLorentzVector.
1618 
1619 Int_t TROOT::IgnoreInclude(const char *fname, const char * /*expandedfname*/)
1620 {
1621  if (fname == 0) return 0;
1622 
1623  TString stem(fname);
1624  // Remove extension if any, ignore files with extension not being .h*
1625  Int_t where = stem.Last('.');
1626  if (where != kNPOS) {
1627  if (stem.EndsWith(".so") || stem.EndsWith(".sl") ||
1628  stem.EndsWith(".dl") || stem.EndsWith(".a") ||
1629  stem.EndsWith(".dll", TString::kIgnoreCase))
1630  return 0;
1631  stem.Remove(where);
1632  }
1633 
1634  TString className = gSystem->BaseName(stem);
1635  TClass* cla = R__GetClassIfKnown(className);
1636  if (!cla) {
1637  // Try again with modifications to the file name:
1638  className = stem;
1639  className.ReplaceAll("/", "::");
1640  className.ReplaceAll("\\", "::");
1641  if (className.Contains(":::")) {
1642  // "C:\dir" becomes "C:::dir".
1643  // fname corresponds to whatever is stated after #include and
1644  // a full path name usually means that it's not a regular #include
1645  // but e.g. a ".L", so we can assume that this is not a header of
1646  // a class in a namespace (a global-namespace class would have been
1647  // detected already before).
1648  return 0;
1649  }
1650  cla = R__GetClassIfKnown(className);
1651  }
1652 
1653  if (!cla) {
1654  return 0;
1655  }
1656 
1657  // cla is valid, check wether it's actually in the header of the same name:
1658  if (cla->GetDeclFileLine() <= 0) return 0; // to a void an error with VisualC++
1659  TString decfile = gSystem->BaseName(cla->GetDeclFileName());
1660  if (decfile != gSystem->BaseName(fname)) {
1661  return 0;
1662  }
1663  return 1;
1664 }
1665 
1666 ////////////////////////////////////////////////////////////////////////////////
1667 /// Initialize operating system interface.
1668 
1670 {
1671  if (gSystem == 0) {
1672 #if defined(R__UNIX)
1673 #if defined(R__HAS_COCOA)
1674  gSystem = new TMacOSXSystem;
1675 #else
1676  gSystem = new TUnixSystem;
1677 #endif
1678 #elif defined(R__WIN32)
1679  gSystem = new TWinNTSystem;
1680 #else
1681  gSystem = new TSystem;
1682 #endif
1683 
1684  if (gSystem->Init())
1685  fprintf(stderr, "Fatal in <TROOT::InitSystem>: can't init operating system layer\n");
1686 
1687  if (!gSystem->HomeDirectory()) {
1688  fprintf(stderr, "Fatal in <TROOT::InitSystem>: HOME directory not set\n");
1689  fprintf(stderr, "Fix this by defining the HOME shell variable\n");
1690  }
1691 
1692  // read default files
1693  gEnv = new TEnv(".rootrc");
1694 
1695  gDebug = gEnv->GetValue("Root.Debug", 0);
1696 
1697  if (!gEnv->GetValue("Root.ErrorHandlers", 1))
1698  gSystem->ResetSignals();
1699 
1700  // by default the zipmode is 1 (see Bits.h)
1701  Int_t zipmode = gEnv->GetValue("Root.ZipMode", 1);
1702  if (zipmode != 1) R__SetZipMode(zipmode);
1703 
1704  const char *sdeb;
1705  if ((sdeb = gSystem->Getenv("ROOTDEBUG")))
1706  gDebug = atoi(sdeb);
1707 
1708  if (gDebug > 0 && isatty(2))
1709  fprintf(stderr, "Info in <TROOT::InitSystem>: running with gDebug = %d\n", gDebug);
1710 
1711  if (gEnv->GetValue("Root.MemStat", 0))
1713  int msize = gEnv->GetValue("Root.MemStat.size", -1);
1714  int mcnt = gEnv->GetValue("Root.MemStat.cnt", -1);
1715  if (msize != -1 || mcnt != -1)
1716  TStorage::EnableStatistics(msize, mcnt);
1717 
1718  fgMemCheck = gEnv->GetValue("Root.MemCheck", 0);
1719 
1720 #if defined(R__HAS_COCOA)
1721  // create and delete a dummy TUrl so that TObjectStat table does not contain
1722  // objects that are deleted after recording is turned-off (in next line),
1723  // like the TUrl::fgSpecialProtocols list entries which are created in the
1724  // TMacOSXSystem ctor.
1725  { TUrl dummy("/dummy"); }
1726 #endif
1727  TObject::SetObjectStat(gEnv->GetValue("Root.ObjectStat", 0));
1728  }
1729 }
1730 
1731 ////////////////////////////////////////////////////////////////////////////////
1732 /// Load and initialize thread library.
1733 
1735 {
1736  if (gEnv->GetValue("Root.UseThreads", 0) || gEnv->GetValue("Root.EnableThreadSafety", 0)) {
1738  }
1739 }
1740 
1741 ////////////////////////////////////////////////////////////////////////////////
1742 /// Initialize the interpreter. Should be called only after main(),
1743 /// to make sure LLVM/Clang is fully initialized.
1744 
1746 {
1747  // usedToIdentifyRootClingByDlSym is available when TROOT is part of
1748  // rootcling.
1749  if (!dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")
1750  && !dlsym(RTLD_DEFAULT, "usedToIdentifyStaticRoot")) {
1751  // Make sure no llvm symbols are visible before loading libCling. If they
1752  // exist libCling will use those and not ours, causing havoc in the
1753  // interpreter. Look for an extern "C" symbol to avoid mangling; look for a
1754  // symbol from llvm because clang builds on top, so users would likely
1755  // have also their own llvm symbols when providing their own clang.
1756  void *LLVMEnablePrettyStackTraceAddr = 0;
1757  // Can't use gSystem->DynFindSymbol() because that iterates over all *known*
1758  // libraries which is not the same!
1759  LLVMEnablePrettyStackTraceAddr = dlsym(RTLD_DEFAULT, "LLVMEnablePrettyStackTrace");
1760  if (LLVMEnablePrettyStackTraceAddr) {
1761  Error("InitInterpreter()", "LLVM SYMBOLS ARE EXPOSED TO CLING! "
1762  "This will cause problems; please hide them or dlopen() them "
1763  "after the call to TROOT::InitInterpreter()!");
1764  }
1765 
1766  const char *libcling = 0;
1767  char *libclingStorage = 0;
1768 #ifdef ROOTLIBDIR
1769  libcling = ROOTLIBDIR "/libCling."
1770 # ifdef R__WIN32
1771  "dll";
1772 # else
1773  "so";
1774 # endif
1775 #else
1776  libclingStorage = gSystem->DynamicPathName("libCling");
1777  libcling = libclingStorage;
1778 #endif
1779  gInterpreterLib = dlopen(libcling, RTLD_LAZY|RTLD_LOCAL);
1780  delete [] libclingStorage;
1781 
1782  if (!gInterpreterLib) {
1783  TString err = dlerror();
1784  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load library %s\n", err.Data());
1785  exit(1);
1786  }
1787  dlerror(); // reset error message
1788  } else {
1789  gInterpreterLib = RTLD_DEFAULT;
1790  }
1792  if (!CreateInterpreter) {
1793  TString err = dlerror();
1794  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load symbol %s\n", err.Data());
1795  exit(1);
1796  }
1797  // Schedule the destruction of TROOT.
1798  atexit(at_exit_of_TROOT);
1799 
1800  gDestroyInterpreter = (DestroyInterpreter_t*) dlsym(gInterpreterLib, "DestroyInterpreter");
1801  if (!gDestroyInterpreter) {
1802  TString err = dlerror();
1803  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load symbol %s\n", err.Data());
1804  exit(1);
1805  }
1806 
1808 
1811 
1812  fgRootInit = kTRUE;
1813 
1814  // Initialize all registered dictionaries.
1815  for (std::vector<ModuleHeaderInfo_t>::const_iterator
1816  li = GetModuleHeaderInfoBuffer().begin(),
1817  le = GetModuleHeaderInfoBuffer().end(); li != le; ++li) {
1818  // process buffered module registrations
1819  fInterpreter->RegisterModule(li->fModuleName,
1820  li->fHeaders,
1821  li->fIncludePaths,
1822  li->fPayloadCode,
1823  li->fFwdDeclCode,
1824  li->fTriggerFunc,
1825  li->fFwdNargsToKeepColl,
1826  li->fClassesHeaders);
1827  }
1828  GetModuleHeaderInfoBuffer().clear();
1829 
1831 
1832  // Read the rules before enabling the auto loading to not inadvertently
1833  // load the libraries for the classes concerned even-though the user is
1834  // *not* using them.
1835  TClass::ReadRules(); // Read the default customization rules ...
1836 
1837  // Enable autoloading
1839 }
1840 
1841 ////////////////////////////////////////////////////////////////////////////////
1842 /// Helper function used by TClass::GetClass().
1843 /// This function attempts to load the dictionary for 'classname'
1844 /// either from the TClassTable or from the list of generator.
1845 /// If silent is 'true', do not warn about missing dictionary for the class.
1846 /// (typically used for class that are used only for transient members)
1847 ///
1848 /// The 'requestedname' is expected to be already normalized.
1849 
1850 TClass *TROOT::LoadClass(const char *requestedname, Bool_t silent) const
1851 {
1852  return TClass::LoadClass(requestedname, silent);
1853 }
1854 
1855 ////////////////////////////////////////////////////////////////////////////////
1856 /// Check if class "classname" is known to the interpreter (in fact,
1857 /// this check is not needed anymore, so classname is ignored). If
1858 /// not it will load library "libname". If the library name does
1859 /// not start with "lib", "lib" will be prepended and a search will
1860 /// be made in the DynamicPath (see .rootrc). If not found a search
1861 /// will be made on libname (without "lib" prepended) and if not found
1862 /// a direct try of libname will be made (in case it contained an
1863 /// absolute path).
1864 /// If check is true it will only check if libname exists and is
1865 /// readable.
1866 /// Returns 0 on successful loading, -1 in case libname does not
1867 /// exist or in case of error and -2 in case of version mismatch.
1868 
1869 Int_t TROOT::LoadClass(const char * /*classname*/, const char *libname,
1870  Bool_t check)
1871 {
1872  Int_t err = -1;
1873 
1874  char *path;
1875  TString lib = libname;
1876  if (!lib.BeginsWith("lib"))
1877  lib = "lib" + lib;
1878  if ((path = gSystem->DynamicPathName(lib, kTRUE))) {
1879  if (check)
1880  err = 0;
1881  else {
1882  err = gSystem->Load(path, 0, kTRUE);
1883  }
1884  delete [] path;
1885  } else {
1886  if (check) {
1887  FileStat_t stat;
1888  if (!gSystem->GetPathInfo(libname, stat)) {
1889  if (R_ISREG(stat.fMode) &&
1891  err = 0;
1892  else
1893  err = -1;
1894  } else
1895  err = -1;
1896  } else {
1897  err = gSystem->Load(libname, 0, kTRUE);
1898  }
1899  }
1900 
1901  if (err == -1) {
1902  //Error("LoadClass", "library %s could not be loaded", libname);
1903  }
1904 
1905  if (err == 1) {
1906  //Error("LoadClass", "library %s already loaded, but class %s unknown",
1907  // libname, classname);
1908  err = 0;
1909  }
1910 
1911  return err;
1912 }
1913 
1914 ////////////////////////////////////////////////////////////////////////////////
1915 /// Return true if the file is local and is (likely) to be a ROOT file
1916 
1918 {
1919  Bool_t result = kFALSE;
1920  FILE *mayberootfile = fopen(filename,"rb");
1921  if (mayberootfile) {
1922  char header[5];
1923  if (fgets(header,5,mayberootfile)) {
1924  result = strncmp(header,"root",4)==0;
1925  }
1926  fclose(mayberootfile);
1927  }
1928  return result;
1929 }
1930 
1931 ////////////////////////////////////////////////////////////////////////////////
1932 /// To list all objects of the application.
1933 /// Loop on all objects created in the ROOT linked lists.
1934 /// Objects may be files and windows or any other object directly
1935 /// attached to the ROOT linked list.
1936 
1937 void TROOT::ls(Option_t *option) const
1938 {
1939 // TObject::SetDirLevel();
1940 // GetList()->R__FOR_EACH(TObject,ls)(option);
1941  TDirectory::ls(option);
1942 }
1943 
1944 ////////////////////////////////////////////////////////////////////////////////
1945 /// Load a macro in the interpreter's memory. Equivalent to the command line
1946 /// command ".L filename". If the filename has "+" or "++" appended
1947 /// the macro will be compiled by ACLiC. The filename must have the format:
1948 /// [path/]macro.C[+|++[g|O]].
1949 /// The possible error codes are defined by TInterpreter::EErrorCode.
1950 /// If check is true it will only check if filename exists and is
1951 /// readable.
1952 /// Returns 0 on successful loading and -1 in case filename does not
1953 /// exist or in case of error.
1954 
1955 Int_t TROOT::LoadMacro(const char *filename, int *error, Bool_t check)
1956 {
1957  Int_t err = -1;
1958  Int_t lerr, *terr;
1959  if (error)
1960  terr = error;
1961  else
1962  terr = &lerr;
1963 
1964  if (fInterpreter) {
1965  TString aclicMode;
1966  TString arguments;
1967  TString io;
1968  TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
1969 
1970  if (arguments.Length()) {
1971  Warning("LoadMacro", "argument(%s) ignored in %s", arguments.Data(), GetMacroPath());
1972  }
1973  char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
1974  if (!mac) {
1975  if (!check)
1976  Error("LoadMacro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
1977  *terr = TInterpreter::kFatal;
1978  } else {
1979  err = 0;
1980  if (!check) {
1981  fname = mac;
1982  fname += aclicMode;
1983  fname += io;
1984  gInterpreter->LoadMacro(fname.Data(), (TInterpreter::EErrorCode*)terr);
1985  if (*terr)
1986  err = -1;
1987  }
1988  }
1989  delete [] mac;
1990  }
1991  return err;
1992 }
1993 
1994 ////////////////////////////////////////////////////////////////////////////////
1995 /// Execute a macro in the interpreter. Equivalent to the command line
1996 /// command ".x filename". If the filename has "+" or "++" appended
1997 /// the macro will be compiled by ACLiC. The filename must have the format:
1998 /// [path/]macro.C[+|++[g|O]][(args)].
1999 /// The possible error codes are defined by TInterpreter::EErrorCode.
2000 /// If padUpdate is true (default) update the current pad.
2001 /// Returns the macro return value.
2002 
2003 Long_t TROOT::Macro(const char *filename, Int_t *error, Bool_t padUpdate)
2004 {
2005  Long_t result = 0;
2006 
2007  if (fInterpreter) {
2008  TString aclicMode;
2009  TString arguments;
2010  TString io;
2011  TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
2012 
2013  char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
2014  if (!mac) {
2015  Error("Macro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
2016  if (error)
2017  *error = TInterpreter::kFatal;
2018  } else {
2019  fname = mac;
2020  fname += aclicMode;
2021  fname += arguments;
2022  fname += io;
2023  result = gInterpreter->ExecuteMacro(fname, (TInterpreter::EErrorCode*)error);
2024  }
2025  delete [] mac;
2026 
2027  if (padUpdate && gPad)
2028  gPad->Update();
2029  }
2030 
2031  return result;
2032 }
2033 
2034 ////////////////////////////////////////////////////////////////////////////////
2035 /// Process message id called by obj.
2036 
2038 {
2040  TMessageHandler *mh;
2041  while ((mh = (TMessageHandler*)next())) {
2042  mh->HandleMessage(id,obj);
2043  }
2044 }
2045 
2046 ////////////////////////////////////////////////////////////////////////////////
2047 /// Process interpreter command via TApplication::ProcessLine().
2048 /// On Win32 the line will be processed asynchronously by sending
2049 /// it to the CINT interpreter thread. For explicit synchronous processing
2050 /// use ProcessLineSync(). On non-Win32 platforms there is no difference
2051 /// between ProcessLine() and ProcessLineSync().
2052 /// The possible error codes are defined by TInterpreter::EErrorCode. In
2053 /// particular, error will equal to TInterpreter::kProcessing until the
2054 /// CINT interpreted thread has finished executing the line.
2055 /// Returns the result of the command, cast to a Long_t.
2056 
2057 Long_t TROOT::ProcessLine(const char *line, Int_t *error)
2058 {
2059  TString sline = line;
2060  sline = sline.Strip(TString::kBoth);
2061 
2062  if (!fApplication.load())
2064 
2065  return (*fApplication).ProcessLine(sline, kFALSE, error);
2066 }
2067 
2068 ////////////////////////////////////////////////////////////////////////////////
2069 /// Process interpreter command via TApplication::ProcessLine().
2070 /// On Win32 the line will be processed synchronously (i.e. it will
2071 /// only return when the CINT interpreter thread has finished executing
2072 /// the line). On non-Win32 platforms there is no difference between
2073 /// ProcessLine() and ProcessLineSync().
2074 /// The possible error codes are defined by TInterpreter::EErrorCode.
2075 /// Returns the result of the command, cast to a Long_t.
2076 
2078 {
2079  TString sline = line;
2080  sline = sline.Strip(TString::kBoth);
2081 
2082  if (!fApplication.load())
2084 
2085  return (*fApplication).ProcessLine(sline, kTRUE, error);
2086 }
2087 
2088 ////////////////////////////////////////////////////////////////////////////////
2089 /// Process interpreter command directly via CINT interpreter.
2090 /// Only executable statements are allowed (no variable declarations),
2091 /// In all other cases use TROOT::ProcessLine().
2092 /// The possible error codes are defined by TInterpreter::EErrorCode.
2093 
2095 {
2096  TString sline = line;
2097  sline = sline.Strip(TString::kBoth);
2098 
2099  if (!fApplication.load())
2101 
2102  Long_t result = 0;
2103 
2104  if (fInterpreter) {
2106  result = gInterpreter->Calc(sline, code);
2107  }
2108 
2109  return result;
2110 }
2111 
2112 ////////////////////////////////////////////////////////////////////////////////
2113 /// Read Git commit information and branch name from the
2114 /// etc/gitinfo.txt file.
2115 
2117 {
2118 #ifdef ROOT_GIT_COMMIT
2120 #endif
2121 #ifdef ROOT_GIT_BRANCH
2123 #endif
2124 
2125  TString gitinfo = "gitinfo.txt";
2126  char *filename = 0;
2127 #ifdef ROOTETCDIR
2128  filename = gSystem->ConcatFileName(ROOTETCDIR, gitinfo);
2129 #else
2130  TString etc = gRootDir;
2131 #ifdef WIN32
2132  etc += "\\etc";
2133 #else
2134  etc += "/etc";
2135 #endif
2136 #if defined(R__MACOSX) && (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
2137  // on iOS etc does not exist and gitinfo resides in $ROOTSYS
2138  etc = gRootDir;
2139 #endif
2140  filename = gSystem->ConcatFileName(etc, gitinfo);
2141 #endif
2142 
2143  FILE *fp = fopen(filename, "r");
2144  if (fp) {
2145  TString s;
2146  // read branch name
2147  s.Gets(fp);
2148  fGitBranch = s;
2149  // read commit SHA1
2150  s.Gets(fp);
2151  fGitCommit = s;
2152  // read date/time make was run
2153  s.Gets(fp);
2154  fGitDate = s;
2155  fclose(fp);
2156  }
2157  delete [] filename;
2158 }
2159 
2161  TTHREAD_TLS(Bool_t) fgReadingObject = false;
2162  return fgReadingObject;
2163 }
2164 
2165 ////////////////////////////////////////////////////////////////////////////////
2166 /// Deprecated (will be removed in next release).
2167 
2169 {
2170  return GetReadingObject();
2171 }
2172 
2174 {
2175  GetReadingObject() = flag;
2176 }
2177 
2178 
2179 ////////////////////////////////////////////////////////////////////////////////
2180 /// Return date/time make was run.
2181 
2182 const char *TROOT::GetGitDate()
2183 {
2184  if (fGitDate == "") {
2185  Int_t iday,imonth,iyear, ihour, imin;
2186  static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2187  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
2188  Int_t idate = gROOT->GetBuiltDate();
2189  Int_t itime = gROOT->GetBuiltTime();
2190  iday = idate%100;
2191  imonth = (idate/100)%100;
2192  iyear = idate/10000;
2193  ihour = itime/100;
2194  imin = itime%100;
2195  fGitDate.Form("%s %02d %4d, %02d:%02d:00", months[imonth-1], iday, iyear, ihour, imin);
2196  }
2197  return fGitDate;
2198 }
2199 
2200 ////////////////////////////////////////////////////////////////////////////////
2201 /// Refresh all browsers. Call this method when some command line
2202 /// command or script has changed the browser contents. Not needed
2203 /// for objects that have the kMustCleanup bit set. Most useful to
2204 /// update browsers that show the file system or other objects external
2205 /// to the running ROOT session.
2206 
2208 {
2210  TBrowser *b;
2211  while ((b = (TBrowser*) next()))
2212  b->SetRefreshFlag(kTRUE);
2213 }
2214 ////////////////////////////////////////////////////////////////////////////////
2215 /// Insure that the files, canvases and sockets are closed.
2216 
2217 static void CallCloseFiles()
2218 {
2220  gROOT->CloseFiles();
2221  }
2222 }
2223 
2224 ////////////////////////////////////////////////////////////////////////////////
2225 /// Called by static dictionary initialization to register clang modules
2226 /// for headers. Calls TCling::RegisterModule() unless gCling
2227 /// is NULL, i.e. during startup, where the information is buffered in
2228 /// the static GetModuleHeaderInfoBuffer().
2229 
2230 void TROOT::RegisterModule(const char* modulename,
2231  const char** headers,
2232  const char** includePaths,
2233  const char* payloadCode,
2234  const char* fwdDeclCode,
2235  void (*triggerFunc)(),
2236  const TInterpreter::FwdDeclArgsToKeepCollection_t& fwdDeclsArgToSkip,
2237  const char** classesHeaders)
2238 {
2239 
2240  // First a side track to insure proper end of process behavior.
2241 
2242  // Register for each loaded dictionary (and thus for each library),
2243  // that we need to Close the ROOT files as soon as this library
2244  // might start being unloaded after main.
2245  //
2246  // By calling atexit here (rather than directly from within the
2247  // library) we make sure that this is not called if the library is
2248  // 'only' dlclosed.
2249 
2250  // On Ubuntu the linker strips the unused libraries. Eventhough
2251  // stressHistogram is explicitly linked against libNet, it is not
2252  // retained and thus is loaded only as needed in the middle part of
2253  // the execution. Concretely this also means that it is loaded
2254  // *after* the construction of the TApplication object and thus
2255  // after the registration (atexit) of the EndOfProcessCleanups
2256  // routine. Consequently, after the end of main, libNet is
2257  // unloaded before EndOfProcessCleanups is called. When
2258  // EndOfProcessCleanups is executed it indirectly needs the TClass
2259  // for TSocket and its search will use resources that have already
2260  // been unloaded (technically the function static in TUnixSystem's
2261  // DynamicPath and the dictionary from libNet).
2262 
2263  // Similarly, the ordering (before this commit) was broken in the
2264  // following case:
2265 
2266  // TApplication creation (EndOfProcessCleanups registration)
2267  // load UserLibrary
2268  // create TFile
2269  // Append UserObject to TFile
2270 
2271  // and after the end of main the order of execution was
2272 
2273  // unload UserLibrary
2274  // call EndOfProcessCleanups
2275  // Write the TFile
2276  // attempt to write the user object.
2277  // ....
2278 
2279  // where what we need is to have the files closen/written before
2280  // the unloading of the library.
2281 
2282  // To solve the problem we now register an atexit function for
2283  // every dictionary thus making sure there is at least one executed
2284  // before the first library tear down after main.
2285 
2286  // If atexit is called directly within a library's code, the
2287  // function will called *either* when the library is 'dlclose'd or
2288  // after then end of main (whichever comes first). We do *not*
2289  // want the files to be closed whenever a library is unloaded via
2290  // dlclose. To avoid this, we add the function (CallCloseFiles)
2291  // from the dictionary indirectly (via ROOT::RegisterModule). In
2292  // this case the function will only only be called either when
2293  // libCore is 'dlclose'd or right after the end of main.
2294 
2295  atexit(CallCloseFiles);
2296 
2297  // Now register with TCling.
2298  if (gCling) {
2299  gCling->RegisterModule(modulename, headers, includePaths, payloadCode, fwdDeclCode,
2300  triggerFunc, fwdDeclsArgToSkip, classesHeaders);
2301  } else {
2302  GetModuleHeaderInfoBuffer()
2303  .push_back(ModuleHeaderInfo_t (modulename, headers, includePaths, payloadCode, fwdDeclCode,
2304  triggerFunc, fwdDeclsArgToSkip,classesHeaders));
2305  }
2306 }
2307 
2308 ////////////////////////////////////////////////////////////////////////////////
2309 /// Remove a class from the list and map of classes.
2310 /// This routine is deprecated, use TClass::RemoveClass directly.
2311 
2313 {
2314  TClass::RemoveClass(oldcl);
2315 }
2316 
2317 ////////////////////////////////////////////////////////////////////////////////
2318 /// Delete all global interpreter objects created since the last call to Reset
2319 ///
2320 /// If option="a" is set reset to startup context (i.e. unload also
2321 /// all loaded files, classes, structs, typedefs, etc.).
2322 ///
2323 /// This function is typically used at the beginning (or end) of an unnamed macro
2324 /// to clean the environment.
2325 ///
2326 /// IMPORTANT WARNING:
2327 /// Do not use this call from within any function (neither compiled nor
2328 /// interpreted. This should only be used from a unnamed macro
2329 /// (which starts with a { (curly braces) ). For example, using TROOT::Reset
2330 /// from within an interpreted function will lead to the unloading of the
2331 /// dictionary and source file, including the one defining the function being
2332 /// executed.
2333 ///
2334 
2335 void TROOT::Reset(Option_t *option)
2336 {
2337  if (IsExecutingMacro()) return; //True when TMacro::Exec runs
2338  if (fInterpreter) {
2339  if (!strncmp(option, "a", 1)) {
2340  fInterpreter->Reset();
2342  } else
2343  gInterpreter->ResetGlobals();
2344 
2345  if (fGlobals) fGlobals->Unload();
2347 
2348  SaveContext();
2349  }
2350 }
2351 
2352 ////////////////////////////////////////////////////////////////////////////////
2353 /// Save the current interpreter context.
2354 
2356 {
2357  if (fInterpreter)
2358  gInterpreter->SaveGlobalsContext();
2359 }
2360 
2361 ////////////////////////////////////////////////////////////////////////////////
2362 /// Set the default graphical cut class name for the graphics editor
2363 /// By default the graphics editor creates an instance of a class TCutG.
2364 /// This function may be called to specify a different class that MUST
2365 /// derive from TCutG
2366 
2367 void TROOT::SetCutClassName(const char *name)
2368 {
2369  if (!name) {
2370  Error("SetCutClassName","Invalid class name");
2371  return;
2372  }
2373  TClass *cl = TClass::GetClass(name);
2374  if (!cl) {
2375  Error("SetCutClassName","Unknown class:%s",name);
2376  return;
2377  }
2378  if (!cl->InheritsFrom("TCutG")) {
2379  Error("SetCutClassName","Class:%s does not derive from TCutG",name);
2380  return;
2381  }
2382  fCutClassName = name;
2383 }
2384 
2385 ////////////////////////////////////////////////////////////////////////////////
2386 /// Set editor mode
2387 
2388 void TROOT::SetEditorMode(const char *mode)
2389 {
2390  fEditorMode = 0;
2391  if (!mode[0]) return;
2392  if (!strcmp(mode,"Arc")) {fEditorMode = kArc; return;}
2393  if (!strcmp(mode,"Line")) {fEditorMode = kLine; return;}
2394  if (!strcmp(mode,"Arrow")) {fEditorMode = kArrow; return;}
2395  if (!strcmp(mode,"Button")) {fEditorMode = kButton; return;}
2396  if (!strcmp(mode,"Diamond")) {fEditorMode = kDiamond; return;}
2397  if (!strcmp(mode,"Ellipse")) {fEditorMode = kEllipse; return;}
2398  if (!strcmp(mode,"Pad")) {fEditorMode = kPad; return;}
2399  if (!strcmp(mode,"Pave")) {fEditorMode = kPave; return;}
2400  if (!strcmp(mode,"PaveLabel")){fEditorMode = kPaveLabel; return;}
2401  if (!strcmp(mode,"PaveText")) {fEditorMode = kPaveText; return;}
2402  if (!strcmp(mode,"PavesText")){fEditorMode = kPavesText; return;}
2403  if (!strcmp(mode,"PolyLine")) {fEditorMode = kPolyLine; return;}
2404  if (!strcmp(mode,"CurlyLine")){fEditorMode = kCurlyLine; return;}
2405  if (!strcmp(mode,"CurlyArc")) {fEditorMode = kCurlyArc; return;}
2406  if (!strcmp(mode,"Text")) {fEditorMode = kText; return;}
2407  if (!strcmp(mode,"Marker")) {fEditorMode = kMarker; return;}
2408  if (!strcmp(mode,"CutG")) {fEditorMode = kCutG; return;}
2409 }
2410 
2411 ////////////////////////////////////////////////////////////////////////////////
2412 /// Change current style to style with name stylename
2413 
2414 void TROOT::SetStyle(const char *stylename)
2415 {
2416  TString style_name = stylename;
2417 
2418  TStyle *style = GetStyle(style_name);
2419  if (style) style->cd();
2420  else Error("SetStyle","Unknown style:%s",style_name.Data());
2421 }
2422 
2423 
2424 //-------- Static Member Functions ---------------------------------------------
2425 
2426 
2427 ////////////////////////////////////////////////////////////////////////////////
2428 /// Decrease the indentation level for ls().
2429 
2431 {
2432  return --fgDirLevel;
2433 }
2434 
2435 ////////////////////////////////////////////////////////////////////////////////
2436 ///return directory level
2437 
2439 {
2440  return fgDirLevel;
2441 }
2442 
2443 ////////////////////////////////////////////////////////////////////////////////
2444 /// Get macro search path. Static utility function.
2445 
2446 const char *TROOT::GetMacroPath()
2447 {
2448  TString &macroPath = ROOT::GetMacroPath();
2449 
2450  if (macroPath.Length() == 0) {
2451  macroPath = gEnv->GetValue("Root.MacroPath", (char*)0);
2452 #if defined(R__WIN32)
2453  macroPath.ReplaceAll("; ", ";");
2454 #else
2455  macroPath.ReplaceAll(": ", ":");
2456 #endif
2457  if (macroPath.Length() == 0)
2458 #if !defined(R__WIN32)
2459  #ifdef ROOTMACRODIR
2460  macroPath = ".:" ROOTMACRODIR;
2461  #else
2462  macroPath = TString(".:") + gRootDir + "/macros";
2463  #endif
2464 #else
2465  #ifdef ROOTMACRODIR
2466  macroPath = ".;" ROOTMACRODIR;
2467  #else
2468  macroPath = TString(".;") + gRootDir + "/macros";
2469  #endif
2470 #endif
2471  }
2472 
2473  return macroPath;
2474 }
2475 
2476 ////////////////////////////////////////////////////////////////////////////////
2477 /// Set or extend the macro search path. Static utility function.
2478 /// If newpath=0 or "" reset to value specified in the rootrc file.
2479 
2480 void TROOT::SetMacroPath(const char *newpath)
2481 {
2482  TString &macroPath = ROOT::GetMacroPath();
2483 
2484  if (!newpath || !*newpath)
2485  macroPath = "";
2486  else
2487  macroPath = newpath;
2488 }
2489 
2490 ////////////////////////////////////////////////////////////////////////////////
2491 /// Increase the indentation level for ls().
2492 
2494 {
2495  return ++fgDirLevel;
2496 }
2497 
2498 ////////////////////////////////////////////////////////////////////////////////
2499 /// Functions used by ls() to indent an object hierarchy.
2500 
2502 {
2503  for (int i = 0; i < fgDirLevel; i++) std::cout.put(' ');
2504 }
2505 
2506 ////////////////////////////////////////////////////////////////////////////////
2507 /// Return kTRUE if the TROOT object has been initialized.
2508 
2510 {
2511  return fgRootInit;
2512 }
2513 
2514 ////////////////////////////////////////////////////////////////////////////////
2515 /// Return kTRUE if the memory leak checker is on.
2516 
2518 {
2519  return fgMemCheck;
2520 }
2521 
2522 ////////////////////////////////////////////////////////////////////////////////
2523 /// Return Indentation level for ls().
2524 
2526 {
2527  fgDirLevel = level;
2528 }
2529 
2530 ////////////////////////////////////////////////////////////////////////////////
2531 /// Convert version code to an integer, i.e. 331527 -> 51507.
2532 
2534 {
2535  return 10000*(code>>16) + 100*((code&65280)>>8) + (code&255);
2536 }
2537 
2538 ////////////////////////////////////////////////////////////////////////////////
2539 /// Convert version as an integer to version code as used in RVersion.h.
2540 
2542 {
2543  int a = v/10000;
2544  int b = (v - a*10000)/100;
2545  int c = v - a*10000 - b*100;
2546  return (a << 16) + (b << 8) + c;
2547 }
2548 
2549 ////////////////////////////////////////////////////////////////////////////////
2550 /// Return ROOT version code as defined in RVersion.h.
2551 
2553 {
2554  return ROOT_VERSION_CODE;
2555 }
2556 
2557 ////////////////////////////////////////////////////////////////////////////////
2558 
2560  static const char** extraInterpArgs = 0;
2561  return extraInterpArgs;
2562 }
2563 
2564 ////////////////////////////////////////////////////////////////////////////////
2565 /// Get the tutorials directory in the installation. Static utility function.
2566 
2568 {
2569 #ifdef ROOTTUTDIR
2570  return ROOTTUTDIR;
2571 #else
2572  static TString tutdir = TString(gRootDir) + "/tutorials";
2573  return tutdir;
2574 #endif
2575 }
TSeqCollection * fStreamerInfo
Definition: TROOT.h:148
virtual const char * GetTypeName() const
Get type of global variable, e,g.
Definition: TGlobal.cxx:111
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
Definition: TBrowser.cxx:259
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:912
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1213
Bool_t fExecutingMacro
Definition: TROOT.h:125
void AddClass(TClass *cl)
Add a class to the list and map of classes.
Definition: TROOT.cxx:827
virtual void Add(TObject *obj)
TListOfFunctionTemplates * fFuncTemplate
Definition: TROOT.h:131
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:851
TInterpreter * CreateInterpreter_t(void *shlibHandle)
Definition: TInterpreter.h:498
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:32
R__EXTERN TGuiFactory * gBatchGuiFactory
Definition: TGuiFactory.h:69
A collection of TDataMember objects designed for fast access given a DeclId_t and for keep track of T...
Semi-Abstract base class defining a generic interface to the underlying, low level, native graphics backend (X11, Win32, MacOS, OpenGL...).
Definition: TVirtualX.h:70
virtual TString SplitAclicMode(const char *filename, TString &mode, TString &args, TString &io) const
This method split a filename of the form: ~~~ {.cpp} [path/]macro.C[+|++[k|f|g|O|c|s|d|v|-]][(args)]...
Definition: TSystem.cxx:3994
An array of TObjects.
Definition: TObjArray.h:39
virtual void Clear(Option_t *option="")=0
TServerSocket * ss
Definition: hserv2.C:30
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Definition: TROOT.cxx:2430
static Bool_t BlockAllSignals(Bool_t b)
Block or unblock all signals. Returns the previous block status.
Definition: TQObject.cxx:1323
TFolder * fRootFolder
Definition: TROOT.h:156
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Definition: vector.h:433
TCollection * GetListOfEnums(Bool_t load=kFALSE)
Definition: TROOT.cxx:1463
ROOT top level object description.
Definition: TROOT.h:84
void * DestroyInterpreter_t(TInterpreter *)
Definition: TInterpreter.h:499
This class is a specialized TProcessID managing the list of UUIDs.
Definition: TProcessUUID.h:34
TSeqCollection * fProofs
Definition: TROOT.h:151
TClass * FindSTLClass(const char *name, Bool_t load, Bool_t silent=kFALSE) const
return a TClass object corresponding to 'name' assuming it is an STL container.
Definition: TROOT.cxx:1204
void RemoveClass(TClass *)
Remove a class from the list and map of classes.
Definition: TROOT.cxx:2312
TCollection * GetListOfGlobalFunctions(Bool_t load=kFALSE)
Return list containing the TFunctions currently defined.
Definition: TROOT.cxx:1532
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:865
Int_t LoadMacro(const char *filename, Int_t *error=0, Bool_t check=kFALSE)
Load a macro in the interpreter's memory.
Definition: TROOT.cxx:1955
virtual void Build(TFile *motherFile=0, TDirectory *motherDir=0)
Initialise directory to defaults.
Definition: TDirectory.cxx:198
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:487
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
static const char **& GetExtraInterpreterArgs()
Definition: TROOT.cxx:2559
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Ssiz_t Length() const
Definition: TString.h:390
TLine * line
TSeqCollection * fGeometries
Definition: TROOT.h:143
static Func_t GetSymInLibThread(const char *funcname)
Definition: TROOT.cxx:372
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:97
Handle messages that might be generated by the system.
TStyle * GetStyle(const char *name) const
Return pointer to style with name.
Definition: TROOT.cxx:1299
TDictionary::DeclId_t DeclId_t
Definition: TInterpreter.h:236
return c
virtual TObject * FindObject(const char *name) const
Returns address of a ROOT object if it exists.
Definition: TROOT.cxx:1037
const char Option_t
Definition: RtypesCore.h:62
Dictionary for function template This class describes one single function template.
void DisableImplicitMT()
Disables the implicit multi-threading in ROOT.
Definition: TROOT.cxx:428
tuple offset
Definition: tree.py:93
static TVirtualX *& Instance()
Returns gVirtualX global.
Definition: TVirtualX.cxx:56
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
void EnableImplicitMT(UInt_t numthreads=0)
Globally enables the implicit multi-threading in ROOT, activating the parallel execution of those met...
Definition: TROOT.cxx:419
#define ROOT_RELEASE_TIME
Definition: RVersion.h:19
TList * fList
Definition: TDirectory.h:99
R__EXTERN TVirtualMutex * gInterpreterMutex
Definition: TInterpreter.h:46
This class represents a WWW compatible URL.
Definition: TUrl.h:41
Int_t fVersionDate
Definition: TROOT.h:107
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
Definition: Buttons.h:33
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1311
Bool_t fForceStyle
Definition: TROOT.h:122
virtual void HandleMessage(Int_t id, const TObject *obj)
Store message origin, keep statistics and call Notify().
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
static Int_t RootVersionCode()
Return ROOT version code as defined in RVersion.h.
Definition: TROOT.cxx:2552
static Bool_t MemCheck()
Return kTRUE if the memory leak checker is on.
Definition: TROOT.cxx:2517
TString fVersion
Definition: TROOT.h:104
void R__SetZipMode(int)
virtual const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
Definition: TSystem.cxx:873
#define ROOT_RELEASE_DATE
Definition: RVersion.h:18
static void SetObjectStat(Bool_t stat)
Turn on/off tracking of objects in the TObjectTable.
Definition: TObject.cxx:999
This class implements a mutex interface.
Definition: TVirtualMutex.h:34
virtual TObject * FindObject(const char *name) const
Specialize FindObject to do search for the a function just by name or create it if its not already in...
static const char * filename()
void InitInterpreter()
Initialize the interpreter.
Definition: TROOT.cxx:1745
#define gROOT
Definition: TROOT.h:344
void LoadHandlersFromEnv(TEnv *env)
Load plugin handlers specified in config file, like: Plugin.TFile: ^rfio: TRFIOFile RFI...
TROOT * GetROOT2()
Definition: TROOT.cxx:358
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1766
The TEnv class reads config files, by default named .rootrc.
Definition: TEnv.h:128
Basic string class.
Definition: TString.h:137
TSeqCollection * GetListOfStyles() const
Definition: TROOT.h:229
void RefreshBrowsers()
Refresh all browsers.
Definition: TROOT.cxx:2207
void ls(Option_t *option="") const
To list all objects of the application.
Definition: TROOT.cxx:1937
TString & GetMacroPath()
Definition: TROOT.cxx:392
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TSeqCollection * GetListOfColors() const
Definition: TROOT.h:220
TArc * a
Definition: textangle.C:12
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
Definition: TInterpreter.h:108
const Bool_t kFALSE
Definition: Rtypes.h:92
#define gInterpreter
Definition: TInterpreter.h:502
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1459
Int_t fVersionCode
Definition: TROOT.h:106
void Reset(Option_t *option="")
Delete all global interpreter objects created since the last call to Reset.
Definition: TROOT.cxx:2335
Definition: Buttons.h:30
void Load()
Load all the DataMembers known to the interpreter for the scope 'fClass' into this collection...
TCollection * GetListOfFunctionOverloads(const char *name) const
Return the collection of functions named "name".
Definition: TROOT.cxx:1381
TFunction * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
This class registers for all classes their name, id and dictionary function in a hash table...
Definition: TClassTable.h:40
#define ROOT_VERSION_CODE
Definition: RVersion.h:21
virtual void ResetSignals()
Reset signals handlers to previous behaviour.
Definition: TSystem.cxx:588
std::atomic< TApplication * > fApplication
Definition: TROOT.h:115
void SetStyle(const char *stylename="Default")
Change current style to style with name stylename.
Definition: TROOT.cxx:2414
TCollection * GetListOfGlobals(Bool_t load=kFALSE)
Return list containing the TGlobals currently defined.
Definition: TROOT.cxx:1497
TString fGitCommit
Definition: TROOT.h:111
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:558
TROOT * GetROOT1()
Definition: TROOT.cxx:351
TObject * GetGeometry(const char *name) const
Return pointer to Geometry with name.
Definition: TROOT.cxx:1456
TSeqCollection * GetListOfBrowsers() const
Definition: TROOT.h:233
TFile * f
Bool_t R_ISREG(Int_t mode)
Definition: TSystem.h:129
virtual void AddLast(TObject *obj)
Add object at the end of the list.
Definition: TList.cxx:137
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
TString fCutClassName
Definition: TROOT.h:159
Bool_t & GetReadingObject()
Definition: TROOT.cxx:2160
static const char * GetTutorialsDir()
Get the tutorials directory in the installation. Static utility function.
Definition: TROOT.cxx:2567
TListOfFunctions * GetGlobalFunctions()
Internal routine returning, and creating if necessary, the list of global function.
Definition: TROOT.cxx:1372
TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE) const
Return pointer to class with name. Obsolete, use TClass::GetClass directly.
Definition: TROOT.cxx:1238
static Int_t fgDirLevel
Definition: TROOT.h:92
Definition: Buttons.h:30
static const char * GetMacroPath()
Get macro search path. Static utility function.
Definition: TROOT.cxx:2446
TInterpreter * fInterpreter
Definition: TROOT.h:116
Int_t fMode
Definition: TSystem.h:138
static TList & GetEarlyRegisteredGlobals()
Definition: TGlobal.cxx:171
const char * GetGitDate()
Return date/time make was run.
Definition: TROOT.cxx:2182
virtual void cd()
Change current style.
Definition: TStyle.cxx:303
virtual void ls(Option_t *option="") const
List Directory contents.
Definition: TDirectory.cxx:998
AListOfEnums_t fEnums
Definition: TROOT.h:154
#define ROOT_GIT_BRANCH
Definition: RGitCommit.h:3
const char * Data() const
Definition: TString.h:349
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:946
TSeqCollection * fMappedFiles
Definition: TROOT.h:136
virtual void Delete(Option_t *option="")=0
Delete this object.
#define SafeDelete(p)
Definition: RConfig.h:436
Sequenceable collection abstract base class.
static void * gInterpreterLib
Definition: TROOT.cxx:154
TVirtualMutex * gROOTMutex
Definition: TROOT.cxx:157
THashTable implements a hash table to store TObject's.
Definition: THashTable.h:39
static TVirtualPad *& Pad()
Return the current pad for the current thread.
Definition: TVirtualPad.cxx:30
Int_t fVersionInt
Definition: TROOT.h:105
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:36
void SetEditorMode(const char *mode="")
Set editor mode.
Definition: TROOT.cxx:2388
const char * FindObjectClassName(const char *name) const
Returns class name of a ROOT object including CINT globals.
Definition: TROOT.cxx:1173
static Int_t ReadRules()
Read the class.rules files from the default location:.
Definition: TClass.cxx:1714
TSeqCollection * fCleanups
Definition: TROOT.h:146
Int_t fEditorMode
Definition: TROOT.h:126
Bool_t fMustClean
Definition: TROOT.h:120
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
Definition: TROOT.cxx:2509
void EndOfProcessCleanups()
Execute the cleanups necessary at the end of the process, in particular those that must be executed b...
Definition: TROOT.cxx:989
int d
Definition: tornado.py:11
static Bool_t fgRootInit
Definition: TROOT.h:93
virtual void AddAll(const TCollection *col)
Long_t ProcessLineSync(const char *line, Int_t *error=0)
Process interpreter command via TApplication::ProcessLine().
Definition: TROOT.cxx:2077
void Message(Int_t id, const TObject *obj)
Process message id called by obj.
Definition: TROOT.cxx:2037
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1575
TCollection * GetListOfFunctionTemplates()
Definition: TROOT.cxx:1480
static Int_t ITIMQQ(const char *time)
Return built time as integer (with min precision), i.e.
Definition: TROOT.cxx:197
virtual void EnableAutoLoading()=0
void SaveContext()
Save the current interpreter context.
Definition: TROOT.cxx:2355
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
Definition: TDirectory.cxx:517
virtual void Delete(Option_t *option="")
Delete all TFunction object files.
static void at_exit_of_TROOT()
Definition: TROOT.cxx:269
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
TSeqCollection * fClipboard
Definition: TROOT.h:152
virtual void Initialize()=0
TFolder * AddFolder(const char *name, const char *title, TCollection *collection=0)
Create a new folder and add it to the list of folders of this folder, return a pointer to the created...
Definition: TFolder.cxx:184
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
R__EXTERN TGuiFactory * gGuiFactory
Definition: TGuiFactory.h:68
static void Cleanup()
static function (called by TROOT destructor) to delete all TProcessIDs
Definition: TProcessID.cxx:173
void Error(const char *location, const char *msgfmt,...)
R__EXTERN TPluginManager * gPluginMgr
Definition: Buttons.h:38
Bool_t fEscape
Definition: TROOT.h:124
TSeqCollection * fFiles
Definition: TROOT.h:135
Describes an Operating System directory for the browser.
TCollection * fClasses
Definition: TROOT.h:129
A doubly linked list.
Definition: TList.h:47
Long_t Macro(const char *filename, Int_t *error=0, Bool_t padUpdate=kTRUE)
Execute a macro in the interpreter.
Definition: TROOT.cxx:2003
R__EXTERN TVirtualMutex * gGlobalMutex
Definition: TVirtualMutex.h:29
TStyle objects may be created to define special styles.
Definition: TStyle.h:52
R__EXTERN TROOT * gROOTLocal
Definition: TROOT.h:341
TSeqCollection * GetListOfGeometries() const
Definition: TROOT.h:232
Bool_t fEditHistograms
Definition: TROOT.h:118
const char Int_t const char TProof Int_t const char * workdir
Definition: TXSlave.cxx:46
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual void AddLast(TObject *obj)=0
Bool_t ClassSaved(TClass *cl)
return class status bit kClassSaved for class cl This function is called by the SavePrimitive functio...
Definition: TROOT.cxx:865
Int_t fVersionTime
Definition: TROOT.h:108
static void RegisterModule(const char *modulename, const char **headers, const char **includePaths, const char *payLoadCode, const char *fwdDeclCode, void(*triggerFunc)(), const FwdDeclArgsToKeepCollection_t &fwdDeclsArgToSkip, const char **classesHeaders)
Called by static dictionary initialization to register clang modules for headers. ...
Definition: TROOT.cxx:2230
R__EXTERN TVirtualX * gGXBatch
Definition: TVirtualX.h:365
static Bool_t fgMemCheck
Definition: TROOT.h:94
TROOT *(* GetROOTFun_t)()
Definition: TROOT.cxx:368
TSeqCollection * fDataSets
Definition: TROOT.h:153
Definition: Buttons.h:33
TSeqCollection * fMessageHandlers
Definition: TROOT.h:147
Bool_t ReadingObject() const
Deprecated (will be removed in next release).
Definition: TROOT.cxx:2168
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2207
void Browse(TBrowser *b)
Add browsable objects to TBrowser.
Definition: TROOT.cxx:846
virtual Bool_t Init()
Initialize the OS interface.
Definition: TSystem.cxx:186
void AddClassGenerator(TClassGenerator *gen)
Add a class generator.
Definition: TROOT.cxx:837
TString fDefCanvasName
Definition: TROOT.h:160
R__EXTERN TSystem * gSystem
Definition: TSystem.h:545
void SetCutClassName(const char *name="TCutG")
Set the default graphical cut class name for the graphics editor By default the graphics editor creat...
Definition: TROOT.cxx:2367
Definition: Buttons.h:33
SVector< double, 2 > v
Definition: Dict.h:5
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
void GetNormalizedName(std::string &norm_name, std::string_view name)
Return the normalized name.
Definition: TClassEdit.cxx:777
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:46
Int_t gDebug
Definition: TROOT.cxx:454
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:494
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:187
TPluginManager * fPluginManager
Definition: TROOT.h:158
TString fGitBranch
Definition: TROOT.h:112
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:390
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the , or until EOF.
Definition: Stringio.cxx:198
TSeqCollection * fSecContexts
Definition: TROOT.h:150
Collection abstract base class.
Definition: TCollection.h:48
void SetRefreshFlag(Bool_t flag)
Definition: TBrowser.h:101
static Int_t ConvertVersionCode2Int(Int_t code)
Convert version code to an integer, i.e. 331527 -> 51507.
Definition: TROOT.cxx:2533
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2308
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
void ReadGitInfo()
Read Git commit information and branch name from the etc/gitinfo.txt file.
Definition: TROOT.cxx:2116
Short_t GetDeclFileLine() const
Definition: TClass.h:386
virtual void RegisterModule(const char *, const char **, const char **, const char *, const char *, void(*)(), const FwdDeclArgsToKeepCollection_t &fwdDeclArgsToKeep, const char **classesHeaders)=0
static void EnableStatistics(int size=-1, int ix=-1)
Enable memory usage statistics gathering.
Definition: TStorage.cxx:433
This class implements a plugin library manager.
Int_t LoadClass(const char *classname, const char *libname, Bool_t check=kFALSE)
Check if class "classname" is known to the interpreter (in fact, this check is not needed anymore...
Definition: TROOT.cxx:1869
Objects following this interface can be passed onto the TROOT object to implement a user customized w...
static TProcessID * AddProcessID()
Static function to add a new TProcessID to the list of PIDs.
Definition: TProcessID.cxx:89
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1056
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
virtual void SaveContext()=0
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:29
TSeqCollection * GetListOfFiles() const
Definition: TROOT.h:225
virtual TObjLink * FirstLink() const
Definition: TList.h:101
A collection of TDataType designed to hold the typedef information and numerical type information...
Definition: TListOfTypes.h:32
void SetName(const char *name)
Definition: TCollection.h:116
TROOT * GetROOT()
Definition: TROOT.cxx:388
static TInterpreter * Instance()
returns gInterpreter global
void *(* GlobalFunc_t)()
Definition: TGlobal.h:56
void InitSystem()
Initialize operating system interface.
Definition: TROOT.cxx:1669
#define gVirtualX
Definition: TVirtualX.h:362
TSeqCollection * fSpecials
Definition: TROOT.h:145
TGlobal * GetGlobal(const char *name, Bool_t load=kFALSE) const
Return pointer to global variable by name.
Definition: TROOT.cxx:1340
static void CreateApplication()
Static function used to create a default application environment.
static void RemoveClass(TClass *cl)
static: Remove a class from the list and map of classes
Definition: TClass.cxx:472
Bool_t IsExecutingMacro() const
Definition: TROOT.h:267
TString fGitDate
Definition: TROOT.h:113
static void SetDirLevel(Int_t level=0)
Return Indentation level for ls().
Definition: TROOT.cxx:2525
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
long Long_t
Definition: RtypesCore.h:50
Option_t * GetOption() const
Definition: TCollection.h:160
TListOfFunctions * fGlobalFunctions
Definition: TROOT.h:133
Long_t ProcessLine(const char *line, Int_t *error=0)
Process interpreter command via TApplication::ProcessLine().
Definition: TROOT.cxx:2057
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
virtual Int_t GetSize() const
Definition: TCollection.h:95
TSeqCollection * fCanvases
Definition: TROOT.h:138
virtual TObject * FindObjectAnyFile(const char *name) const
Scan the memory lists of all files for an object with name.
Definition: TROOT.cxx:1156
static void BuildStyles()
Create some standard styles.
Definition: TStyle.cxx:287
virtual void SetName(const char *newname)
Set the name for directory If the directory name is changed after the directory was written once...
void EnableThreadSafety()
Enables the global mutex to make ROOT thread safe/aware.
Definition: TROOT.cxx:399
TFunction * GetGlobalFunctionWithPrototype(const char *name, const char *proto=0, Bool_t load=kFALSE)
Return pointer to global function by name.
Definition: TROOT.cxx:1427
static DestroyInterpreter_t * gDestroyInterpreter
Definition: TROOT.cxx:153
void SetReadingObject(Bool_t flag=kTRUE)
Definition: TROOT.cxx:2173
virtual Func_t DynFindSymbol(const char *module, const char *entry)
Find specific entry point in specified library.
Definition: TSystem.cxx:1930
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:415
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
Definition: TSystem.cxx:1906
TString fConfigOptions
Definition: TROOT.h:102
void InitThreads()
Load and initialize thread library.
Definition: TROOT.cxx:1734
void Unload()
Mark 'all func' as being unloaded.
Describe directory structure in memory.
Definition: TDirectory.h:44
static TDirectory *& CurrentDirectory()
Return the current directory for the current thread.
Definition: TDirectory.cxx:316
void(* VoidFuncPtr_t)()
Definition: Rtypes.h:74
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
static void AddClass(TClass *cl)
static: Add a class to the list and map of classes.
Definition: TClass.cxx:446
Definition: Buttons.h:31
Bool_t fFromPopUp
Definition: TROOT.h:119
static RooMathCoreReg dummy
Int_t fTimer
Definition: TROOT.h:114
TCanvas * style()
Definition: style.C:1
static void CallCloseFiles()
Insure that the files, canvases and sockets are closed.
Definition: TROOT.cxx:2217
TCanvas * MakeDefCanvas() const
Return a default canvas.
Definition: TROOT.cxx:1274
Bool_t fBatch
Definition: TROOT.h:117
Long_t ProcessLineFast(const char *line, Int_t *error=0)
Process interpreter command directly via CINT interpreter.
Definition: TROOT.cxx:2094
void CloseFiles()
Close any files and sockets that gROOT knows about.
Definition: TROOT.cxx:911
virtual ~TROOT()
Clean up and free resources used by ROOT (files, network sockets, shared memory segments, etc.).
Definition: TROOT.cxx:702
#define R__LOCKGUARD(mutex)
The color creation and management class.
Definition: TColor.h:47
TSeqCollection * fStyles
Definition: TROOT.h:139
virtual void Add(TObject *obj)=0
virtual void CleanCompiledMacros()
Remove the shared libs produced by the CompileMacro() function.
Definition: TSystem.cxx:4079
Bool_t fReadingObject
Definition: TROOT.h:121
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2801
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:349
TCollection * fClassGenerators
Definition: TROOT.h:149
ClassImp(TROOT) TROOT
Default ctor.
Definition: TROOT.cxx:457
Int_t IgnoreInclude(const char *fname, const char *expandedfname)
Return 1 if the name of the given include file corresponds to a class that is known to ROOT...
Definition: TROOT.cxx:1619
static TClass * LoadClass(const char *requestedname, Bool_t silent)
Helper function used by TClass::GetClass().
Definition: TClass.cxx:5288
virtual void Reset()=0
virtual void Delete(Option_t *option="")
Delete all TDataMember object files.
#define name(a, b)
Definition: linkTestLib0.cpp:5
const char * FindObjectPathName(const TObject *obj) const
Return path name of obj somewhere in the //root/...
Definition: TROOT.cxx:1193
static Int_t GetDirLevel()
return directory level
Definition: TROOT.cxx:2438
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at //root.
Definition: TROOT.cxx:1146
Int_t fBuiltTime
Definition: TROOT.h:110
Mother of all ROOT objects.
Definition: TObject.h:58
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
This ABC is a factory for GUI components.
Definition: TGuiFactory.h:44
TFunction * GetGlobalFunction(const char *name, const char *params=0, Bool_t load=kFALSE)
Return pointer to global function by name.
Definition: TROOT.cxx:1394
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
Definition: TROOT.h:176
static Int_t ConvertVersionInt2Code(Int_t v)
Convert version as an integer to version code as used in RVersion.h.
Definition: TROOT.cxx:2541
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
Definition: TROOT.cxx:2493
typedef void((*Func_t)())
TCollection * GetListOfTypes(Bool_t load=kFALSE)
Return a dynamic list giving access to all TDataTypes (typedefs) currently defined.
Definition: TROOT.cxx:1571
TFile * GetFile() const
Definition: TROOT.h:248
Int_t fBuiltDate
Definition: TROOT.h:109
void Unload()
Mark 'all func' as being unloaded.
const char * GetDeclFileName() const
Definition: TClass.h:385
TFunctionTemplate * GetFunctionTemplate(const char *name)
Definition: TROOT.cxx:1327
TDataType * GetType(const char *name, Bool_t load=kFALSE) const
Return pointer to type with name.
Definition: TROOT.cxx:1282
void Load()
Load all the functions known to the interpreter for the scope 'fClass' into this collection.
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at this folder.
Definition: TFolder.cxx:350
TColor * GetColor(Int_t color) const
Return address of color with index color.
Definition: TROOT.cxx:1256
TCollection * fFunctions
Definition: TROOT.h:140
static void SetMacroPath(const char *newpath)
Set or extend the macro search path.
Definition: TROOT.cxx:2480
static Int_t IDATQQ(const char *date)
Return built date as integer, i.e. "Apr 28 2000" -> 20000428.
Definition: TROOT.cxx:176
virtual void Add(TObject *obj)
Definition: TList.h:81
const Ssiz_t kNPOS
Definition: Rtypes.h:115
TListOfDataMembers * fGlobals
Definition: TROOT.h:132
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
Definition: TROOT.cxx:437
R__EXTERN const char * gRootDir
Definition: TSystem.h:233
TSeqCollection * fClosedObjects
Definition: TROOT.h:134
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
TObject * GetFunction(const char *name) const
Return pointer to function with name.
Definition: TROOT.cxx:1307
#define ROOT_RELEASE
Definition: RVersion.h:17
TF1 * f1
Definition: legend1.C:11
static Int_t IVERSQ()
Return version id as an integer, i.e. "2.22/04" -> 22204.
Definition: TROOT.cxx:166
Int_t fLineIsProcessing
Definition: TROOT.h:90
TSeqCollection * fTasks
Definition: TROOT.h:141
static void CleanUpROOTAtExit()
Clean up at program termination before global objects go out of scope.
Definition: TROOT.cxx:207
TSeqCollection * fColors
Definition: TROOT.h:142
#define NULL
Definition: Rtypes.h:82
TCollection * fTypes
Definition: TROOT.h:130
#define gPad
Definition: TVirtualPad.h:288
TSeqCollection * fBrowsers
Definition: TROOT.h:144
Bool_t IsRootFile(const char *filename) const
Return true if the file is local and is (likely) to be a ROOT file.
Definition: TROOT.cxx:1917
static GetROOTFun_t gGetROOT
Definition: TROOT.cxx:370
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2501
#define gDirectory
Definition: TDirectory.h:221
static void InitializeColors()
Initialize colors used by the TCanvas based graphics (via TColor objects).
Definition: TColor.cxx:365
double result[121]
TList * fBrowsables
Definition: TROOT.h:157
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4498
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
TSeqCollection * fSockets
Definition: TROOT.h:137
TObject * FindSpecialObject(const char *name, void *&where)
Returns address and folder of a ROOT object if it exists.
Definition: TROOT.cxx:1087
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:504
R__DLLEXPORT TInterpreter * CreateInterpreter(void *interpLibHandle)
Definition: TCling.cxx:575
Bool_t fInterrupt
Definition: TROOT.h:123
Abstract base class defining a generic interface to the underlying Operating System.
Definition: TSystem.h:258
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
TObject * obj
void Idle(UInt_t idleTimeInSec, const char *command=0)
Execute command when system has been idle for idleTimeInSec seconds.
Definition: TROOT.cxx:1583
#define ROOT_GIT_COMMIT
Definition: RGitCommit.h:4
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TObject.cxx:379
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1028
#define sym(otri1, otri2)
Definition: triangle.c:932
static TClass * R__GetClassIfKnown(const char *className)
Check whether className is a known class, and only autoload if we can.
Definition: TROOT.cxx:1598
TString fConfigFeatures
Definition: TROOT.h:103
TProcessUUID * fUUIDs
Definition: TROOT.h:155
static void PrintStatistics()
Print memory usage statistics.
Definition: TStorage.cxx:389
const TObject * fPrimitive
Definition: TROOT.h:127
TVirtualPad * fSelectPad
Definition: TROOT.h:128
virtual TObject * First() const =0
virtual TObject * Last() const =0
Int_t GetNumber() const
Definition: TColor.h:83
TDictionary * Get(DeclId_t id)
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904