Logo ROOT   6.19/01
Reference Guide
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 \ingroup Base
14 
15 ROOT top level object description.
16 
17 The TROOT object is the entry point to the ROOT system.
18 The single instance of TROOT is accessible via the global gROOT.
19 Using the gROOT pointer one has access to basically every object
20 created in a ROOT based program. The TROOT object is essentially a
21 container of several lists pointing to the main ROOT objects.
22 
23 The following lists are accessible from gROOT object:
24 
25 ~~~ {.cpp}
26  gROOT->GetListOfClasses
27  gROOT->GetListOfColors
28  gROOT->GetListOfTypes
29  gROOT->GetListOfGlobals
30  gROOT->GetListOfGlobalFunctions
31  gROOT->GetListOfFiles
32  gROOT->GetListOfMappedFiles
33  gROOT->GetListOfSockets
34  gROOT->GetListOfSecContexts
35  gROOT->GetListOfCanvases
36  gROOT->GetListOfStyles
37  gROOT->GetListOfFunctions
38  gROOT->GetListOfSpecials (for example graphical cuts)
39  gROOT->GetListOfGeometries
40  gROOT->GetListOfBrowsers
41  gROOT->GetListOfCleanups
42  gROOT->GetListOfMessageHandlers
43 ~~~
44 
45 The TROOT class provides also many useful services:
46  - Get pointer to an object in any of the lists above
47  - Time utilities TROOT::Time
48 
49 The ROOT object must be created as a static object. An example
50 of a main program creating an interactive version is shown below:
51 
52 ### Example of a main program
53 
54 ~~~ {.cpp}
55  #include "TRint.h"
56 
57  int main(int argc, char **argv)
58  {
59  TRint *theApp = new TRint("ROOT example", &argc, argv);
60 
61  // Init Intrinsics, build all windows, and enter event loop
62  theApp->Run();
63 
64  return(0);
65  }
66 ~~~
67 */
68 
69 #include <ROOT/RConfig.hxx>
70 #include "RConfigure.h"
71 #include "RConfigOptions.h"
72 #include "RVersion.h"
73 #include "RGitCommit.h"
74 
75 #include <string>
76 #include <map>
77 #include <stdlib.h>
78 #ifdef WIN32
79 #include <io.h>
80 #include "Windows4Root.h"
81 #include <Psapi.h>
82 #define RTLD_DEFAULT ((void *)::GetModuleHandle(NULL))
83 //#define dlsym(library, function_name) ::GetProcAddress((HMODULE)library, function_name)
84 #define dlopen(library_name, flags) ::LoadLibrary(library_name)
85 #define dlclose(library) ::FreeLibrary((HMODULE)library)
86 char *dlerror() {
87  static char Msg[1000];
88  FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
89  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), Msg,
90  sizeof(Msg), NULL);
91  return Msg;
92 }
93 FARPROC dlsym(void *library, const char *function_name)
94 {
95  HMODULE hMods[1024];
96  DWORD cbNeeded;
97  FARPROC address = NULL;
98  unsigned int i;
99  if (library == RTLD_DEFAULT) {
100  if (EnumProcessModules(::GetCurrentProcess(), hMods, sizeof(hMods), &cbNeeded)) {
101  for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) {
102  address = ::GetProcAddress((HMODULE)hMods[i], function_name);
103  if (address)
104  return address;
105  }
106  }
107  return address;
108  } else {
109  return ::GetProcAddress((HMODULE)library, function_name);
110  }
111 }
112 #else
113 #include <dlfcn.h>
114 #endif
115 
116 #include "Riostream.h"
117 #include "ROOT/FoundationUtils.hxx"
118 #include "TROOT.h"
119 #include "TClass.h"
120 #include "TClassEdit.h"
121 #include "TClassGenerator.h"
122 #include "TDataType.h"
123 #include "TDatime.h"
124 #include "TStyle.h"
125 #include "TObjectTable.h"
126 #include "TClassTable.h"
127 #include "TSystem.h"
128 #include "THashList.h"
129 #include "TObjArray.h"
130 #include "TEnv.h"
131 #include "TError.h"
132 #include "TColor.h"
133 #include "TGlobal.h"
134 #include "TFunction.h"
135 #include "TVirtualPad.h"
136 #include "TBrowser.h"
137 #include "TSystemDirectory.h"
138 #include "TApplication.h"
139 #include "TInterpreter.h"
140 #include "TGuiFactory.h"
141 #include "TMessageHandler.h"
142 #include "TFolder.h"
143 #include "TQObject.h"
144 #include "TProcessUUID.h"
145 #include "TPluginManager.h"
146 #include "TMap.h"
147 #include "TObjString.h"
148 #include "TVirtualMutex.h"
149 #include "TInterpreter.h"
150 #include "TListOfTypes.h"
151 #include "TListOfDataMembers.h"
152 #include "TListOfEnumsWithLock.h"
153 #include "TListOfFunctions.h"
155 #include "TFunctionTemplate.h"
156 #include "ThreadLocalStorage.h"
157 #include "TVirtualRWMutex.h"
158 
159 #include <string>
160 namespace std {} using namespace std;
161 
162 #if defined(R__UNIX)
163 #if defined(R__HAS_COCOA)
164 #include "TMacOSXSystem.h"
165 #include "TUrl.h"
166 #else
167 #include "TUnixSystem.h"
168 #endif
169 #elif defined(R__WIN32)
170 #include "TWinNTSystem.h"
171 #endif
172 
173 extern "C" void R__SetZipMode(int);
174 
176 static void *gInterpreterLib = 0;
177 
178 // Mutex for protection of concurrent gROOT access
181 
182 // For accessing TThread::Tsd indirectly.
183 void **(*gThreadTsd)(void*,Int_t) = 0;
184 
185 //-------- Names of next three routines are a small homage to CMZ --------------
186 ////////////////////////////////////////////////////////////////////////////////
187 /// Return version id as an integer, i.e. "2.22/04" -> 22204.
188 
189 static Int_t IVERSQ()
190 {
191  Int_t maj, min, cycle;
192  sscanf(ROOT_RELEASE, "%d.%d/%d", &maj, &min, &cycle);
193  return 10000*maj + 100*min + cycle;
194 }
195 
196 ////////////////////////////////////////////////////////////////////////////////
197 /// Return built date as integer, i.e. "Apr 28 2000" -> 20000428.
198 
199 static Int_t IDATQQ(const char *date)
200 {
201  static const char *months[] = {"Jan","Feb","Mar","Apr","May",
202  "Jun","Jul","Aug","Sep","Oct",
203  "Nov","Dec"};
204 
205  char sm[12];
206  Int_t yy, mm=0, dd;
207  sscanf(date, "%s %d %d", sm, &dd, &yy);
208  for (int i = 0; i < 12; i++)
209  if (!strncmp(sm, months[i], 3)) {
210  mm = i+1;
211  break;
212  }
213  return 10000*yy + 100*mm + dd;
214 }
215 
216 ////////////////////////////////////////////////////////////////////////////////
217 /// Return built time as integer (with min precision), i.e.
218 /// "17:32:37" -> 1732.
219 
220 static Int_t ITIMQQ(const char *time)
221 {
222  Int_t hh, mm, ss;
223  sscanf(time, "%d:%d:%d", &hh, &mm, &ss);
224  return 100*hh + mm;
225 }
226 
227 ////////////////////////////////////////////////////////////////////////////////
228 /// Clean up at program termination before global objects go out of scope.
229 
230 static void CleanUpROOTAtExit()
231 {
232  if (gROOT) {
234 
235  if (gROOT->GetListOfFiles())
236  gROOT->GetListOfFiles()->Delete("slow");
237  if (gROOT->GetListOfSockets())
238  gROOT->GetListOfSockets()->Delete();
239  if (gROOT->GetListOfMappedFiles())
240  gROOT->GetListOfMappedFiles()->Delete("slow");
241  if (gROOT->GetListOfClosedObjects())
242  gROOT->GetListOfClosedObjects()->Delete("slow");
243  }
244 }
245 
246 ////////////////////////////////////////////////////////////////////////////////
247 /// A module and its headers. Intentionally not a copy:
248 /// If these strings end up in this struct they are
249 /// long lived by definition because they get passed in
250 /// before initialization of TCling.
251 
252 namespace {
253  struct ModuleHeaderInfo_t {
254  ModuleHeaderInfo_t(const char* moduleName,
255  const char** headers,
256  const char** includePaths,
257  const char* payloadCode,
258  const char* fwdDeclCode,
259  void (*triggerFunc)(),
260  const TROOT::FwdDeclArgsToKeepCollection_t& fwdDeclsArgToSkip,
261  const char **classesHeaders,
262  bool hasCxxModule):
263  fModuleName(moduleName),
264  fHeaders(headers),
265  fPayloadCode(payloadCode),
266  fFwdDeclCode(fwdDeclCode),
267  fIncludePaths(includePaths),
268  fTriggerFunc(triggerFunc),
269  fClassesHeaders(classesHeaders),
270  fFwdNargsToKeepColl(fwdDeclsArgToSkip),
271  fHasCxxModule(hasCxxModule) {}
272 
273  const char* fModuleName; // module name
274  const char** fHeaders; // 0-terminated array of header files
275  const char* fPayloadCode; // Additional code to be given to cling at library load
276  const char* fFwdDeclCode; // Additional code to let cling know about selected classes and functions
277  const char** fIncludePaths; // 0-terminated array of header files
278  void (*fTriggerFunc)(); // Pointer to the dict initialization used to find the library name
279  const char** fClassesHeaders; // 0-terminated list of classes and related header files
280  const TROOT::FwdDeclArgsToKeepCollection_t fFwdNargsToKeepColl; // Collection of
281  // pairs of template fwd decls and number of
282  bool fHasCxxModule; // Whether this module has a C++ module alongside it.
283  };
284 
285  std::vector<ModuleHeaderInfo_t>& GetModuleHeaderInfoBuffer() {
286  static std::vector<ModuleHeaderInfo_t> moduleHeaderInfoBuffer;
287  return moduleHeaderInfoBuffer;
288  }
289 }
290 
294 
295 static void at_exit_of_TROOT() {
298 }
299 
300 // This local static object initializes the ROOT system
301 namespace ROOT {
302 namespace Internal {
303  class TROOTAllocator {
304  // Simple wrapper to separate, time-wise, the call to the
305  // TROOT destructor and the actual free-ing of the memory.
306  //
307  // Since the interpreter implementation (currently TCling) is
308  // loaded via dlopen by libCore, the destruction of its global
309  // variable (i.e. in particular clang's) is scheduled before
310  // those in libCore so we need to schedule the call to the TROOT
311  // destructor before that *but* we want to make sure the memory
312  // stay around until libCore itself is unloaded so that code
313  // using gROOT can 'properly' check for validity.
314  //
315  // The order of loading for is:
316  // libCore.so
317  // libRint.so
318  // ... anything other library hard linked to the executable ...
319  // ... for example libEvent
320  // libCling.so
321  // ... other libraries like libTree for example ....
322  // and the destruction order is (of course) the reverse.
323  // By default the unloading of the dictionary, does use
324  // the service of the interpreter ... which of course
325  // fails if libCling is already unloaded by that information
326  // has not been registered per se.
327  //
328  // To solve this problem, we now schedule the destruction
329  // of the TROOT object to happen _just_ before the
330  // unloading/destruction of libCling so that we can
331  // maximize the amount of clean-up we can do correctly
332  // and we can still allocate the TROOT object's memory
333  // statically.
334  //
335  char fHolder[sizeof(TROOT)];
336  public:
337  TROOTAllocator() {
338  new(&(fHolder[0])) TROOT("root", "The ROOT of EVERYTHING");
339  }
340 
341  ~TROOTAllocator() {
342  if (gROOTLocal) {
343  gROOTLocal->~TROOT();
344  }
345  }
346  };
347 
348  // The global gROOT is defined to be a function (ROOT::GetROOT())
349  // which itself is dereferencing a function pointer.
350 
351  // Initially this function pointer's value is & GetROOT1 whose role is to
352  // create and initialize the TROOT object itself.
353  // At the very end of the TROOT constructor the value of the function pointer
354  // is switch to & GetROOT2 whose role is to initialize the interpreter.
355 
356  // This mechanism was primarily intended to fix the issues with order in which
357  // global TROOT and LLVM globals are initialized. TROOT was initializing
358  // Cling, but Cling could not be used yet due to LLVM globals not being
359  // Initialized yet. The solution is to delay initializing the interpreter in
360  // TROOT till after main() when all LLVM globals are initialized.
361 
362  // Technically, the mechanism used actually delay the interpreter
363  // initialization until the first use of gROOT *after* the end of the
364  // TROOT constructor.
365 
366  // So to delay until after the start of main, we also made sure that none
367  // of the ROOT code (mostly the dictionary code) used during library loading
368  // is using gROOT (directly or indirectly).
369 
370  // In practice, the initialization of the interpreter is now delayed until
371  // the first use gROOT (or gInterpreter) after the start of main (but user
372  // could easily break this by using gROOT in their library initialization
373  // code).
374 
375  extern TROOT *gROOTLocal;
376 
378  if (gROOTLocal)
379  return gROOTLocal;
380  static TROOTAllocator alloc;
381  return gROOTLocal;
382  }
383 
385  static Bool_t initInterpreter = kFALSE;
386  if (!initInterpreter) {
387  initInterpreter = kTRUE;
389  // Load and init threads library
391  }
392  return gROOTLocal;
393  }
394  typedef TROOT *(*GetROOTFun_t)();
395 
397 
398  static Func_t GetSymInLibImt(const char *funcname)
399  {
400  const static bool loadSuccess = dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")? false : 0 <= gSystem->Load("libImt");
401  if (loadSuccess) {
402  if (auto sym = gSystem->DynFindSymbol(nullptr, funcname)) {
403  return sym;
404  } else {
405  Error("GetSymInLibImt", "Cannot get symbol %s.", funcname);
406  }
407  }
408  return nullptr;
409  }
410 
411  //////////////////////////////////////////////////////////////////////////////
412  /// Globally enables the parallel branch processing, which is a case of
413  /// implicit multi-threading (IMT) in ROOT, activating the required locks.
414  /// This IMT use case, implemented in TTree::GetEntry, spawns a task for
415  /// each branch of the tree. Therefore, a task takes care of the reading,
416  /// decompression and deserialisation of a given branch.
418  {
419 #ifdef R__USE_IMT
420  if (!IsImplicitMTEnabled())
422  static void (*sym)() = (void(*)())Internal::GetSymInLibImt("ROOT_TImplicitMT_EnableParBranchProcessing");
423  if (sym)
424  sym();
425 #else
426  ::Warning("EnableParBranchProcessing", "Cannot enable parallel branch processing, please build ROOT with -Dimt=ON");
427 #endif
428  }
429 
430  //////////////////////////////////////////////////////////////////////////////
431  /// Globally disables the IMT use case of parallel branch processing,
432  /// deactivating the corresponding locks.
434  {
435 #ifdef R__USE_IMT
436  static void (*sym)() = (void(*)())Internal::GetSymInLibImt("ROOT_TImplicitMT_DisableParBranchProcessing");
437  if (sym)
438  sym();
439 #else
440  ::Warning("DisableParBranchProcessing", "Cannot disable parallel branch processing, please build ROOT with -Dimt=ON");
441 #endif
442  }
443 
444  //////////////////////////////////////////////////////////////////////////////
445  /// Returns true if parallel branch processing is enabled.
447  {
448 #ifdef R__USE_IMT
449  static Bool_t (*sym)() = (Bool_t(*)())Internal::GetSymInLibImt("ROOT_TImplicitMT_IsParBranchProcessingEnabled");
450  if (sym)
451  return sym();
452  else
453  return kFALSE;
454 #else
455  return kFALSE;
456 #endif
457  }
458 
459  ////////////////////////////////////////////////////////////////////////////////
460  /// Globally enables the parallel tree processing, which is a case of
461  /// implicit multi-threading in ROOT, activating the required locks.
462  /// This IMT use case, implemented in TTreeProcessor::Process, receives a user
463  /// function and applies it to subranges of the tree, which correspond to its
464  /// clusters. Hence, for every cluster, a task is spawned to potentially
465  /// process it in parallel with the other clusters.
467  {
468 #ifdef R__USE_IMT
469  if (!IsImplicitMTEnabled())
471  static void (*sym)() = (void(*)())Internal::GetSymInLibImt("ROOT_TImplicitMT_EnableParTreeProcessing");
472  if (sym)
473  sym();
474 #else
475  ::Warning("EnableParTreeProcessing", "Cannot enable parallel tree processing, please build ROOT with -Dimt=ON");
476 #endif
477  }
478 
479  //////////////////////////////////////////////////////////////////////////////
480  /// Globally disables the IMT use case of parallel branch processing,
481  /// deactivating the corresponding locks.
483  {
484 #ifdef R__USE_IMT
485  static void (*sym)() = (void(*)())Internal::GetSymInLibImt("ROOT_TImplicitMT_DisableParTreeProcessing");
486  if (sym)
487  sym();
488 #else
489  ::Warning("DisableParTreeProcessing", "Cannot disable parallel tree processing, please build ROOT with -Dimt=ON");
490 #endif
491  }
492 
493  ////////////////////////////////////////////////////////////////////////////////
494  /// Returns true if parallel tree processing is enabled.
496  {
497 #ifdef R__USE_IMT
498  static Bool_t (*sym)() = (Bool_t(*)())Internal::GetSymInLibImt("ROOT_TImplicitMT_IsParTreeProcessingEnabled");
499  if (sym)
500  return sym();
501  else
502  return kFALSE;
503 #else
504  return kFALSE;
505 #endif
506  }
507 
508  ////////////////////////////////////////////////////////////////////////////////
509  /// Keeps track of the status of ImplicitMT w/o resorting to the load of
510  /// libImt
512  {
513  static Bool_t isImplicitMTEnabled = kFALSE;
514  return isImplicitMTEnabled;
515  }
516 
517 } // end of Internal sub namespace
518 // back to ROOT namespace
519 
521  return (*Internal::gGetROOT)();
522  }
523 
525  static TString macroPath;
526  return macroPath;
527  }
528 
529  // clang-format off
530  ////////////////////////////////////////////////////////////////////////////////
531  /// Enables the global mutex to make ROOT thread safe/aware.
532  ///
533  /// The following becomes safe:
534  /// - concurrent construction and destruction of TObjects, including the ones registered in ROOT's global lists (e.g. gROOT->GetListOfCleanups(), gROOT->GetListOfFiles())
535  /// - concurrent usage of _different_ ROOT objects from different threads, including ones with global state (e.g. TFile, TTree, TChain) with the exception of graphics classes (e.g. TCanvas)
536  /// - concurrent calls to ROOT's type system classes, e.g. TClass and TEnum
537  /// - concurrent calls to the interpreter through gInterpreter
538  /// - concurrent loading of ROOT plug-ins
539  ///
540  /// In addition, gDirectory, gFile and gPad become a thread-local variable.
541  /// In all threads, gDirectory defaults to gROOT, a singleton which supports thread-safe insertion and deletion of contents.
542  /// gFile and gPad default to nullptr, as it is for single-thread programs.
543  ///
544  /// The ROOT graphics subsystem is not made thread-safe by this method. In particular drawing or printing different
545  /// canvases from different threads (and analogous operations such as invoking `Draw` on a `TObject`) is not thread-safe.
546  ///
547  /// Note that there is no `DisableThreadSafety()`. ROOT's thread-safety features cannot be disabled once activated.
548  // clang-format on
550  {
551  static void (*sym)() = (void(*)())Internal::GetSymInLibImt("ROOT_TThread_Initialize");
552  if (sym)
553  sym();
554  }
555 
556  ////////////////////////////////////////////////////////////////////////////////
557  /// @param[in] numthreads Number of threads to use. If not specified or
558  /// set to zero, the number of threads is automatically
559  /// decided by the implementation. Any other value is
560  /// used as a hint.
561  ///
562  /// ROOT must be built with the compilation flag `imt=ON` for this feature to be available.
563  /// The following objects and methods automatically take advantage of
564  /// multi-threading if a call to `EnableImplicitMT` has been made before usage:
565  ///
566  /// - RDataFrame internally runs the event-loop by parallelizing over clusters of entries
567  /// - TTree::GetEntry reads multiple branches in parallel
568  /// - TTree::FlushBaskets writes multiple baskets to disk in parallel
569  /// - TTreeCacheUnzip decompresses the baskets contained in a TTreeCache in parallel
570  /// - THx::Fit performs in parallel the evaluation of the objective function over the data
571  /// - TMVA::DNN trains the deep neural networks in parallel
572  /// - TMVA::BDT trains the classifier in parallel and multiclass BDTs are evaluated in parallel
573  ///
574  /// EnableImplicitMT calls in turn EnableThreadSafety.
575  /// The 'numthreads' parameter allows to control the number of threads to
576  /// be used by the implicit multi-threading. However, this parameter is just
577  /// a hint for ROOT: it will try to satisfy the request if the execution
578  /// scenario allows it. For example, if ROOT is configured to use an external
579  /// scheduler, setting a value for 'numthreads' might not have any effect.
580  void EnableImplicitMT(UInt_t numthreads)
581  {
582 #ifdef R__USE_IMT
584  return;
586  static void (*sym)(UInt_t) = (void(*)(UInt_t))Internal::GetSymInLibImt("ROOT_TImplicitMT_EnableImplicitMT");
587  if (sym)
588  sym(numthreads);
590 #else
591  ::Warning("EnableImplicitMT", "Cannot enable implicit multi-threading with %d threads, please build ROOT with -Dimt=ON", numthreads);
592 #endif
593  }
594 
595  ////////////////////////////////////////////////////////////////////////////////
596  /// Disables the implicit multi-threading in ROOT (see EnableImplicitMT).
598  {
599 #ifdef R__USE_IMT
600  static void (*sym)() = (void(*)())Internal::GetSymInLibImt("ROOT_TImplicitMT_DisableImplicitMT");
601  if (sym)
602  sym();
604 #else
605  ::Warning("DisableImplicitMT", "Cannot disable implicit multi-threading, please build ROOT with -Dimt=ON");
606 #endif
607  }
608 
609  ////////////////////////////////////////////////////////////////////////////////
610  /// Returns true if the implicit multi-threading in ROOT is enabled.
612  {
614  }
615 
616  ////////////////////////////////////////////////////////////////////////////////
617  /// Returns the size of the pool used for implicit multi-threading.
619  {
620 #ifdef R__USE_IMT
621  static UInt_t (*sym)() = (UInt_t(*)())Internal::GetSymInLibImt("ROOT_TImplicitMT_GetImplicitMTPoolSize");
622  if (sym)
623  return sym();
624  else
625  return 0;
626 #else
627  return 0;
628 #endif
629  }
630 
631 }
632 
634 
635 // Global debug flag (set to > 0 to get debug output).
636 // Can be set either via the interpreter (gDebug is exported to CINT),
637 // via the rootrc resource "Root.Debug", via the shell environment variable
638 // ROOTDEBUG, or via the debugger.
640 
641 
642 ClassImp(TROOT);
643 
644 ////////////////////////////////////////////////////////////////////////////////
645 /// Default ctor.
646 
648  fLineIsProcessing(0), fVersion(0), fVersionInt(0), fVersionCode(0),
649  fVersionDate(0), fVersionTime(0), fBuiltDate(0), fBuiltTime(0),
650  fTimer(0), fApplication(0), fInterpreter(0), fBatch(kTRUE),
651  fIsWebDisplay(kFALSE), fIsWebDisplayBatch(kFALSE), fEditHistograms(kTRUE),
652  fFromPopUp(kTRUE),fMustClean(kTRUE),fReadingObject(kFALSE),fForceStyle(kFALSE),
653  fInterrupt(kFALSE),fEscape(kFALSE),fExecutingMacro(kFALSE),fEditorMode(0),
654  fPrimitive(0),fSelectPad(0),fClasses(0),fTypes(0),fGlobals(0),fGlobalFunctions(0),
655  fClosedObjects(0),fFiles(0),fMappedFiles(0),fSockets(0),fCanvases(0),fStyles(0),fFunctions(0),
656  fTasks(0),fColors(0),fGeometries(0),fBrowsers(0),fSpecials(0),fCleanups(0),
657  fMessageHandlers(0),fStreamerInfo(0),fClassGenerators(0),fSecContexts(0),
658  fProofs(0),fClipboard(0),fDataSets(0),fUUIDs(0),fRootFolder(0),fBrowsables(0),
659  fPluginManager(0)
660 {
661 }
662 
663 ////////////////////////////////////////////////////////////////////////////////
664 /// Initialize the ROOT system. The creation of the TROOT object initializes
665 /// the ROOT system. It must be the first ROOT related action that is
666 /// performed by a program. The TROOT object must be created on the stack
667 /// (can not be called via new since "operator new" is protected). The
668 /// TROOT object is either created as a global object (outside the main()
669 /// program), or it is one of the first objects created in main().
670 /// Make sure that the TROOT object stays in scope for as long as ROOT
671 /// related actions are performed. TROOT is a so called singleton so
672 /// only one instance of it can be created. The single TROOT object can
673 /// always be accessed via the global pointer gROOT.
674 /// The name and title arguments can be used to identify the running
675 /// application. The initfunc argument can contain an array of
676 /// function pointers (last element must be 0). These functions are
677 /// executed at the end of the constructor. This way one can easily
678 /// extend the ROOT system without adding permanent dependencies
679 /// (e.g. the graphics system is initialized via such a function).
680 
681 TROOT::TROOT(const char *name, const char *title, VoidFuncPtr_t *initfunc)
682  : TDirectory(), fLineIsProcessing(0), fVersion(0), fVersionInt(0), fVersionCode(0),
683  fVersionDate(0), fVersionTime(0), fBuiltDate(0), fBuiltTime(0),
684  fTimer(0), fApplication(0), fInterpreter(0), fBatch(kTRUE),
685  fIsWebDisplay(kFALSE), fIsWebDisplayBatch(kFALSE), fEditHistograms(kTRUE),
686  fFromPopUp(kTRUE),fMustClean(kTRUE),fReadingObject(kFALSE),fForceStyle(kFALSE),
687  fInterrupt(kFALSE),fEscape(kFALSE),fExecutingMacro(kFALSE),fEditorMode(0),
688  fPrimitive(0),fSelectPad(0),fClasses(0),fTypes(0),fGlobals(0),fGlobalFunctions(0),
689  fClosedObjects(0),fFiles(0),fMappedFiles(0),fSockets(0),fCanvases(0),fStyles(0),fFunctions(0),
690  fTasks(0),fColors(0),fGeometries(0),fBrowsers(0),fSpecials(0),fCleanups(0),
691  fMessageHandlers(0),fStreamerInfo(0),fClassGenerators(0),fSecContexts(0),
692  fProofs(0),fClipboard(0),fDataSets(0),fUUIDs(0),fRootFolder(0),fBrowsables(0),
693  fPluginManager(0)
694 {
696  //Warning("TROOT", "only one instance of TROOT allowed");
697  return;
698  }
699 
701 
703  gDirectory = 0;
704 
705  SetName(name);
706  SetTitle(title);
707 
708  // will be used by global "operator delete" so make sure it is set
709  // before anything is deleted
710  fMappedFiles = 0;
711 
712  // create already here, but only initialize it after gEnv has been created
714 
715  // Initialize Operating System interface
716  InitSystem();
717 
718  // Initialize static directory functions
719  GetRootSys();
720  GetBinDir();
721  GetLibDir();
722  GetIncludeDir();
723  GetEtcDir();
724  GetDataDir();
725  GetDocDir();
726  GetMacroDir();
727  GetTutorialDir();
728  GetSourceDir();
729  GetIconPath();
730  GetTTFFontDir();
731 
732  gRootDir = GetRootSys().Data();
733 
734  TDirectory::BuildDirectory(nullptr, nullptr);
735 
736  // Initialize interface to CINT C++ interpreter
737  fVersionInt = 0; // check in TROOT dtor in case TCling fails
738  fClasses = 0; // might be checked via TCling ctor
739  fEnums = 0;
740 
741  fConfigOptions = R__CONFIGUREOPTIONS;
742  fConfigFeatures = R__CONFIGUREFEATURES;
745  fVersionInt = IVERSQ();
748  fBuiltDate = IDATQQ(__DATE__);
749  fBuiltTime = ITIMQQ(__TIME__);
750 
751  ReadGitInfo();
752 
753  fClasses = new THashTable(800,3); fClasses->UseRWLock();
754  //fIdMap = new IdMap_t;
756  fClassGenerators = new TList;
757 
758  // usedToIdentifyRootClingByDlSym is available when TROOT is part of
759  // rootcling.
760  if (!dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")) {
761  // initialize plugin manager early
763  }
764 
765  TSystemDirectory *workdir = new TSystemDirectory("workdir", gSystem->WorkingDirectory());
766 
767  auto setNameLocked = [](TSeqCollection *l, const char *collection_name) {
768  l->SetName(collection_name);
769  l->UseRWLock();
770  return l;
771  };
772 
773  fTimer = 0;
774  fApplication = 0;
775  fColors = setNameLocked(new TObjArray(1000), "ListOfColors");
776  fTypes = 0;
777  fGlobals = 0;
778  fGlobalFunctions = 0;
779  // fList was created in TDirectory::Build but with different sizing.
780  delete fList;
781  fList = new THashList(1000,3); fList->UseRWLock();
782  fClosedObjects = setNameLocked(new TList, "ClosedFiles");
783  fFiles = setNameLocked(new TList, "Files");
784  fMappedFiles = setNameLocked(new TList, "MappedFiles");
785  fSockets = setNameLocked(new TList, "Sockets");
786  fCanvases = setNameLocked(new TList, "Canvases");
787  fStyles = setNameLocked(new TList, "Styles");
788  fFunctions = setNameLocked(new TList, "Functions");
789  fTasks = setNameLocked(new TList, "Tasks");
790  fGeometries = setNameLocked(new TList, "Geometries");
791  fBrowsers = setNameLocked(new TList, "Browsers");
792  fSpecials = setNameLocked(new TList, "Specials");
793  fBrowsables = (TList*)setNameLocked(new TList, "Browsables");
794  fCleanups = setNameLocked(new THashList, "Cleanups");
795  fMessageHandlers = setNameLocked(new TList, "MessageHandlers");
796  fSecContexts = setNameLocked(new TList, "SecContexts");
797  fProofs = setNameLocked(new TList, "Proofs");
798  fClipboard = setNameLocked(new TList, "Clipboard");
799  fDataSets = setNameLocked(new TList, "DataSets");
801 
803  fUUIDs = new TProcessUUID();
804 
805  fRootFolder = new TFolder();
806  fRootFolder->SetName("root");
807  fRootFolder->SetTitle("root of all folders");
808  fRootFolder->AddFolder("Classes", "List of Active Classes",fClasses);
809  fRootFolder->AddFolder("Colors", "List of Active Colors",fColors);
810  fRootFolder->AddFolder("MapFiles", "List of MapFiles",fMappedFiles);
811  fRootFolder->AddFolder("Sockets", "List of Socket Connections",fSockets);
812  fRootFolder->AddFolder("Canvases", "List of Canvases",fCanvases);
813  fRootFolder->AddFolder("Styles", "List of Styles",fStyles);
814  fRootFolder->AddFolder("Functions", "List of Functions",fFunctions);
815  fRootFolder->AddFolder("Tasks", "List of Tasks",fTasks);
816  fRootFolder->AddFolder("Geometries","List of Geometries",fGeometries);
817  fRootFolder->AddFolder("Browsers", "List of Browsers",fBrowsers);
818  fRootFolder->AddFolder("Specials", "List of Special Objects",fSpecials);
819  fRootFolder->AddFolder("Handlers", "List of Message Handlers",fMessageHandlers);
820  fRootFolder->AddFolder("Cleanups", "List of RecursiveRemove Collections",fCleanups);
821  fRootFolder->AddFolder("StreamerInfo","List of Active StreamerInfo Classes",fStreamerInfo);
822  fRootFolder->AddFolder("SecContexts","List of Security Contexts",fSecContexts);
823  fRootFolder->AddFolder("PROOF Sessions", "List of PROOF sessions",fProofs);
824  fRootFolder->AddFolder("ROOT Memory","List of Objects in the gROOT Directory",fList);
825  fRootFolder->AddFolder("ROOT Files","List of Connected ROOT Files",fFiles);
826 
827  // by default, add the list of files, tasks, canvases and browsers in the Cleanups list
833  // And add TROOT's TDirectory personality
834  fCleanups->Add(fList);
835 
838  fFromPopUp = kFALSE;
840  fInterrupt = kFALSE;
841  fEscape = kFALSE;
842  fMustClean = kTRUE;
843  fPrimitive = 0;
844  fSelectPad = 0;
845  fEditorMode = 0;
846  fDefCanvasName = "c1";
848  fLineIsProcessing = 1; // This prevents WIN32 "Windows" thread to pick ROOT objects with mouse
849  gDirectory = this;
850  gPad = 0;
851 
852  //set name of graphical cut class for the graphics editor
853  //cannot call SetCutClassName at this point because the TClass of TCutG
854  //is not yet build
855  fCutClassName = "TCutG";
856 
857  // Create a default MessageHandler
858  new TMessageHandler((TClass*)0);
859 
860  // Create some styles
861  gStyle = 0;
863  SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
864 
865  // Setup default (batch) graphics and GUI environment
868  gGXBatch = new TVirtualX("Batch", "ROOT Interface to batch graphics");
870 
871 #if defined(R__WIN32)
872  fBatch = kFALSE;
873 #elif defined(R__HAS_COCOA)
874  fBatch = kFALSE;
875 #else
876  if (gSystem->Getenv("DISPLAY"))
877  fBatch = kFALSE;
878  else
879  fBatch = kTRUE;
880 #endif
881 
882  int i = 0;
883  while (initfunc && initfunc[i]) {
884  (initfunc[i])();
885  fBatch = kFALSE; // put system in graphics mode (backward compatible)
886  i++;
887  }
888 
889  // Set initial/default list of browsable objects
890  fBrowsables->Add(fRootFolder, "root");
891  fBrowsables->Add(fProofs, "PROOF Sessions");
892  fBrowsables->Add(workdir, gSystem->WorkingDirectory());
893  fBrowsables->Add(fFiles, "ROOT Files");
894 
895  atexit(CleanUpROOTAtExit);
896 
898 }
899 
900 ////////////////////////////////////////////////////////////////////////////////
901 /// Clean up and free resources used by ROOT (files, network sockets,
902 /// shared memory segments, etc.).
903 
905 {
906  using namespace ROOT::Internal;
907 
908  if (gROOTLocal == this) {
909 
910  // If the interpreter has not yet been initialized, don't bother
911  gGetROOT = &GetROOT1;
912 
913  // Mark the object as invalid, so that we can veto some actions
914  // (like autoloading) while we are in the destructor.
916 
917  // Turn-off the global mutex to avoid recreating mutexes that have
918  // already been deleted during the destruction phase
919  gGlobalMutex = 0;
920 
921  // Return when error occurred in TCling, i.e. when setup file(s) are
922  // out of date
923  if (!fVersionInt) return;
924 
925  // ATTENTION!!! Order is important!
926 
927 #ifdef R__COMPLETE_MEM_TERMINATION
929 
930  // FIXME: Causes rootcling to deadlock, debug and uncomment
931  // SafeDelete(fRootFolder);
932 
933  fSpecials->Delete(); SafeDelete(fSpecials); // delete special objects : PostScript, Minuit, Html
934 #endif
935  fClosedObjects->Delete("slow"); // and closed files
936  fFiles->Delete("slow"); // and files
938  fSecContexts->Delete("slow"); SafeDelete(fSecContexts); // and security contexts
939  fSockets->Delete(); SafeDelete(fSockets); // and sockets
940  fMappedFiles->Delete("slow"); // and mapped files
941  TSeqCollection *tl = fMappedFiles; fMappedFiles = 0; delete tl;
942 
944 
945  delete fUUIDs;
946  TProcessID::Cleanup(); // and list of ProcessIDs
947 
948  fFunctions->Delete(); SafeDelete(fFunctions); // etc..
951 #ifdef R__COMPLETE_MEM_TERMINATION
953 #endif
956 
957 #ifdef R__COMPLETE_MEM_TERMINATION
962 #endif
963 
964  // Stop emitting signals
966 
968 
969 #ifdef R__COMPLETE_MEM_TERMINATION
975 
976  fCleanups->Clear();
978  delete gClassTable; gClassTable = 0;
979  delete gEnv; gEnv = 0;
980 
981  if (fTypes) fTypes->Delete();
983  if (fGlobals) fGlobals->Delete();
987  fEnums.load()->Delete();
988 
989  // FIXME: Causes segfault in rootcling, debug and uncomment
990  // fClasses->Delete(); SafeDelete(fClasses); // TClass'es must be deleted last
991 #endif
992 
993  // Remove shared libraries produced by the TSystem::CompileMacro() call
995 
996  // Cleanup system class
997  delete gSystem;
998 
999  // ROOT-6022:
1000  // if (gInterpreterLib) dlclose(gInterpreterLib);
1001 #ifdef R__COMPLETE_MEM_TERMINATION
1002  // On some 'newer' platform (Fedora Core 17+, Ubuntu 12), the
1003  // initialization order is (by default?) is 'wrong' and so we can't
1004  // delete the interpreter now .. because any of the static in the
1005  // interpreter's library have already been deleted.
1006  // On the link line, we must list the most dependent .o file
1007  // and end with the least dependent (LLVM libraries), unfortunately,
1008  // Fedora Core 17+ or Ubuntu 12 will also execute the initialization
1009  // in the same order (hence doing libCore's before LLVM's and
1010  // vice et versa for both the destructor. We worked around the
1011  // initialization order by delay the TROOT creation until first use.
1012  // We can not do the same for destruction as we have no way of knowing
1013  // the last access ...
1014  // So for now, let's avoid delete TCling except in the special build
1015  // checking the completeness of the termination deletion.
1016 
1017  // TODO: Should we do more cleanup here than just call delete?
1018  // Segfaults rootcling in some cases, debug and uncomment:
1019  //
1020  // delete fInterpreter;
1021 
1023 #endif
1024 
1025  // llvm::TimingGroup used for measuring the timing relies the destructors.
1026  // In order to make use of this feature we have to call the destructor of
1027  // TCling which will shut down clang, cling and llvm.
1028  // gSystem->Getenv is not available anymore.
1029  if (::getenv("ROOT_CLING_TIMING"))
1030  delete fInterpreter;
1031 
1032 
1033  // Prints memory stats
1035 
1036  gROOTLocal = 0;
1037  fgRootInit = kFALSE;
1038  }
1039 }
1040 
1041 ////////////////////////////////////////////////////////////////////////////////
1042 /// Add a class to the list and map of classes.
1043 /// This routine is deprecated, use TClass::AddClass directly.
1044 
1046 {
1047  TClass::AddClass(cl);
1048 }
1049 
1050 ////////////////////////////////////////////////////////////////////////////////
1051 /// Add a class generator. This generator will be called by TClass::GetClass
1052 /// in case its does not find a loaded rootcint dictionary to request the
1053 /// creation of a TClass object.
1054 
1056 {
1057  if (!generator) return;
1058  fClassGenerators->Add(generator);
1059 }
1060 
1061 ////////////////////////////////////////////////////////////////////////////////
1062 /// Append object to this directory.
1063 ///
1064 /// If replace is true:
1065 /// remove any existing objects with the same same (if the name is not "")
1066 
1067 void TROOT::Append(TObject *obj, Bool_t replace /* = kFALSE */)
1068 {
1070  TDirectory::Append(obj,replace);
1071 }
1072 
1073 ////////////////////////////////////////////////////////////////////////////////
1074 /// Add browsable objects to TBrowser.
1075 
1077 {
1078  TObject *obj;
1079  TIter next(fBrowsables);
1080 
1081  while ((obj = (TObject *) next())) {
1082  const char *opt = next.GetOption();
1083  if (opt && strlen(opt))
1084  b->Add(obj, opt);
1085  else
1086  b->Add(obj, obj->GetName());
1087  }
1088 }
1089 
1090 ////////////////////////////////////////////////////////////////////////////////
1091 /// return class status bit kClassSaved for class cl
1092 /// This function is called by the SavePrimitive functions writing
1093 /// the C++ code for an object.
1094 
1096 {
1097  if (cl == 0) return kFALSE;
1098  if (cl->TestBit(TClass::kClassSaved)) return kTRUE;
1100  return kFALSE;
1101 }
1102 
1103 namespace {
1104  static void R__ListSlowClose(TList *files)
1105  {
1106  // Routine to close a list of files using the 'slow' techniques
1107  // that also for the deletion ot update the list itself.
1108 
1109  static TObject harmless;
1110  TObjLink *cursor = files->FirstLink();
1111  while (cursor) {
1112  TDirectory *dir = static_cast<TDirectory*>( cursor->GetObject() );
1113  if (dir) {
1114  // In order for the iterator to stay valid, we must
1115  // prevent the removal of the object (dir) from the list
1116  // (which is done in TFile::Close). We can also can not
1117  // just move to the next iterator since the Close might
1118  // also (indirectly) remove that file.
1119  // So we SetObject to a harmless value, so that 'dir'
1120  // is not seen as part of the list.
1121  // We will later, remove all the object (see files->Clear()
1122  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
1123  // See related comment at the files->Clear("nodelete");
1124  dir->Close("nodelete");
1125  // Put it back
1126  cursor->SetObject(dir);
1127  }
1128  cursor = cursor->Next();
1129  };
1130  // Now were done, clear the list but do not delete the objects as
1131  // they have been moved to the list of closed objects and must be
1132  // deleted from there in order to avoid a double delete from a
1133  // use objects (on the interpreter stack).
1134  files->Clear("nodelete");
1135  }
1136 
1137  static void R__ListSlowDeleteContent(TList *files)
1138  {
1139  // Routine to delete the content of list of files using the 'slow' techniques
1140 
1141  static TObject harmless;
1142  TObjLink *cursor = files->FirstLink();
1143  while (cursor) {
1144  TDirectory *dir = dynamic_cast<TDirectory*>( cursor->GetObject() );
1145  if (dir) {
1146  // In order for the iterator to stay valid, we must
1147  // prevent the removal of the object (dir) from the list
1148  // (which is done in TFile::Close). We can also can not
1149  // just move to the next iterator since the Close might
1150  // also (indirectly) remove that file.
1151  // So we SetObject to a harmless value, so that 'dir'
1152  // is not seen as part of the list.
1153  // We will later, remove all the object (see files->Clear()
1154  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
1155  // See related comment at the files->Clear("nodelete");
1156  dir->GetList()->Delete("slow");
1157  // Put it back
1158  cursor->SetObject(dir);
1159  }
1160  cursor = cursor->Next();
1161  };
1162  }
1163 }
1164 
1165 ////////////////////////////////////////////////////////////////////////////////
1166 /// Close any files and sockets that gROOT knows about.
1167 /// This can be used to insures that the files and sockets are closed before any library is unloaded!
1168 
1170 {
1171  if (fFiles && fFiles->First()) {
1172  R__ListSlowClose(static_cast<TList*>(fFiles));
1173  }
1174  // and Close TROOT itself.
1175  Close("slow");
1176  // Now sockets.
1177  if (fSockets && fSockets->First()) {
1178  if (0==fCleanups->FindObject(fSockets) ) {
1181  }
1182  CallFunc_t *socketCloser = gInterpreter->CallFunc_Factory();
1183  Long_t offset = 0;
1184  TClass *socketClass = TClass::GetClass("TSocket");
1185  gInterpreter->CallFunc_SetFuncProto(socketCloser, socketClass->GetClassInfo(), "Close", "", &offset);
1186  if (gInterpreter->CallFunc_IsValid(socketCloser)) {
1187  static TObject harmless;
1188  TObjLink *cursor = static_cast<TList*>(fSockets)->FirstLink();
1189  TList notclosed;
1190  while (cursor) {
1191  TObject *socket = cursor->GetObject();
1192  // In order for the iterator to stay valid, we must
1193  // prevent the removal of the object (dir) from the list
1194  // (which is done in TFile::Close). We can also can not
1195  // just move to the next iterator since the Close might
1196  // also (indirectly) remove that file.
1197  // So we SetObject to a harmless value, so that 'dir'
1198  // is not seen as part of the list.
1199  // We will later, remove all the object (see files->Clear()
1200  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
1201 
1202  if (socket->IsA()->InheritsFrom(socketClass)) {
1203  gInterpreter->CallFunc_Exec(socketCloser, ((char*)socket)+offset);
1204  // Put the object in the closed list for later deletion.
1205  socket->SetBit(kMustCleanup);
1206  fClosedObjects->AddLast(socket);
1207  } else {
1208  // Crap ... this is not a socket, likely Proof or something, let's try to find a Close
1209  Long_t other_offset;
1210  CallFunc_t *otherCloser = gInterpreter->CallFunc_Factory();
1211  gInterpreter->CallFunc_SetFuncProto(otherCloser, socket->IsA()->GetClassInfo(), "Close", "", &other_offset);
1212  if (gInterpreter->CallFunc_IsValid(otherCloser)) {
1213  gInterpreter->CallFunc_Exec(otherCloser, ((char*)socket)+other_offset);
1214  // Put the object in the closed list for later deletion.
1215  socket->SetBit(kMustCleanup);
1216  fClosedObjects->AddLast(socket);
1217  } else {
1218  notclosed.AddLast(socket);
1219  }
1220  gInterpreter->CallFunc_Delete(otherCloser);
1221  // Put it back
1222  cursor->SetObject(socket);
1223  }
1224  cursor = cursor->Next();
1225  }
1226  // Now were done, clear the list
1227  fSockets->Clear();
1228  // Read the one we did not close
1229  cursor = notclosed.FirstLink();
1230  while (cursor) {
1231  static_cast<TList*>(fSockets)->AddLast(cursor->GetObject());
1232  cursor = cursor->Next();
1233  }
1234  }
1235  gInterpreter->CallFunc_Delete(socketCloser);
1236  }
1237  if (fMappedFiles && fMappedFiles->First()) {
1238  R__ListSlowClose(static_cast<TList*>(fMappedFiles));
1239  }
1240 
1241 }
1242 
1243 ////////////////////////////////////////////////////////////////////////////////
1244 /// Execute the cleanups necessary at the end of the process, in particular
1245 /// those that must be executed before the library start being unloaded.
1246 
1248 {
1249  // This will not delete the objects 'held' by the TFiles so that
1250  // they can still be 'reacheable' when ResetGlobals is run.
1251  CloseFiles();
1252 
1253  if (gInterpreter) {
1254  gInterpreter->ResetGlobals();
1255  }
1256 
1257  // Now delete the objects 'held' by the TFiles so that it
1258  // is done before the tear down of the libraries.
1259  if (fClosedObjects && fClosedObjects->First()) {
1260  R__ListSlowDeleteContent(static_cast<TList*>(fClosedObjects));
1261  }
1262 
1263  // Now a set of simpler things to delete. See the same ordering in
1264  // TROOT::~TROOT
1265  fFunctions->Delete();
1266  fGeometries->Delete();
1267  fBrowsers->Delete();
1268  fCanvases->Delete("slow");
1269  fColors->Delete();
1270  fStyles->Delete();
1271 
1273 
1274  if (gInterpreter) {
1275  gInterpreter->ShutDown();
1276  }
1277 }
1278 
1279 
1280 ////////////////////////////////////////////////////////////////////////////////
1281 /// Find an object in one Root folder
1282 
1284 {
1285  Error("FindObject","Not yet implemented");
1286  return 0;
1287 }
1288 
1289 ////////////////////////////////////////////////////////////////////////////////
1290 /// Returns address of a ROOT object if it exists
1291 ///
1292 /// If name contains at least one "/" the function calls FindObjectany
1293 /// else
1294 /// This function looks in the following order in the ROOT lists:
1295 /// - List of files
1296 /// - List of memory mapped files
1297 /// - List of functions
1298 /// - List of geometries
1299 /// - List of canvases
1300 /// - List of styles
1301 /// - List of specials
1302 /// - List of materials in current geometry
1303 /// - List of shapes in current geometry
1304 /// - List of matrices in current geometry
1305 /// - List of Nodes in current geometry
1306 /// - Current Directory in memory
1307 /// - Current Directory on file
1308 
1309 TObject *TROOT::FindObject(const char *name) const
1310 {
1311  if (name && strstr(name,"/")) return FindObjectAny(name);
1312 
1313  TObject *temp = 0;
1314 
1315  temp = fFiles->FindObject(name); if (temp) return temp;
1316  temp = fMappedFiles->FindObject(name); if (temp) return temp;
1317  {
1319  temp = fFunctions->FindObject(name);if (temp) return temp;
1320  }
1321  temp = fGeometries->FindObject(name); if (temp) return temp;
1322  temp = fCanvases->FindObject(name); if (temp) return temp;
1323  temp = fStyles->FindObject(name); if (temp) return temp;
1324  {
1326  temp = fSpecials->FindObject(name); if (temp) return temp;
1327  }
1328  TIter next(fGeometries);
1329  TObject *obj;
1330  while ((obj=next())) {
1331  temp = obj->FindObject(name); if (temp) return temp;
1332  }
1333  if (gDirectory) temp = gDirectory->Get(name);
1334  if (temp) return temp;
1335  if (gPad) {
1336  TVirtualPad *canvas = gPad->GetVirtCanvas();
1337  if (fCanvases->FindObject(canvas)) { //this check in case call from TCanvas ctor
1338  temp = canvas->FindObject(name);
1339  if (!temp && canvas != gPad) temp = gPad->FindObject(name);
1340  }
1341  }
1342  return temp;
1343 }
1344 
1345 ////////////////////////////////////////////////////////////////////////////////
1346 /// Returns address and folder of a ROOT object if it exists
1347 ///
1348 /// This function looks in the following order in the ROOT lists:
1349 /// - List of files
1350 /// - List of memory mapped files
1351 /// - List of functions
1352 /// - List of geometries
1353 /// - List of canvases
1354 /// - List of styles
1355 /// - List of specials
1356 /// - List of materials in current geometry
1357 /// - List of shapes in current geometry
1358 /// - List of matrices in current geometry
1359 /// - List of Nodes in current geometry
1360 /// - Current Directory in memory
1361 /// - Current Directory on file
1362 
1363 TObject *TROOT::FindSpecialObject(const char *name, void *&where)
1364 {
1365  TObject *temp = 0;
1366  where = 0;
1367 
1368  if (!temp) {
1369  temp = fFiles->FindObject(name);
1370  where = fFiles;
1371  }
1372  if (!temp) {
1373  temp = fMappedFiles->FindObject(name);
1374  where = fMappedFiles;
1375  }
1376  if (!temp) {
1378  temp = fFunctions->FindObject(name);
1379  where = fFunctions;
1380  }
1381  if (!temp) {
1382  temp = fCanvases->FindObject(name);
1383  where = fCanvases;
1384  }
1385  if (!temp) {
1386  temp = fStyles->FindObject(name);
1387  where = fStyles;
1388  }
1389  if (!temp) {
1390  temp = fSpecials->FindObject(name);
1391  where = fSpecials;
1392  }
1393  if (!temp) {
1394  TObject *glast = fGeometries->Last();
1395  if (glast) {where = glast; temp = glast->FindObject(name);}
1396  }
1397  if (!temp && gDirectory) {
1398  temp = gDirectory->Get(name);
1399  where = gDirectory;
1400  }
1401  if (!temp && gPad) {
1402  TVirtualPad *canvas = gPad->GetVirtCanvas();
1403  if (fCanvases->FindObject(canvas)) { //this check in case call from TCanvas ctor
1404  temp = canvas->FindObject(name);
1405  where = canvas;
1406  if (!temp && canvas != gPad) {
1407  temp = gPad->FindObject(name);
1408  where = gPad;
1409  }
1410  }
1411  }
1412  if (!temp) return 0;
1413  if (temp->TestBit(kNotDeleted)) return temp;
1414  return 0;
1415 }
1416 
1417 ////////////////////////////////////////////////////////////////////////////////
1418 /// Return a pointer to the first object with name starting at //root.
1419 /// This function scans the list of all folders.
1420 /// if no object found in folders, it scans the memory list of all files.
1421 
1422 TObject *TROOT::FindObjectAny(const char *name) const
1423 {
1425  if (obj) return obj;
1426  return gDirectory->FindObjectAnyFile(name);
1427 }
1428 
1429 ////////////////////////////////////////////////////////////////////////////////
1430 /// Scan the memory lists of all files for an object with name
1431 
1433 {
1435  TDirectory *d;
1436  TIter next(GetListOfFiles());
1437  while ((d = (TDirectory*)next())) {
1438  // Call explicitly TDirectory::FindObject to restrict the search to the
1439  // already in memory object.
1440  TObject *obj = d->TDirectory::FindObject(name);
1441  if (obj) return obj;
1442  }
1443  return 0;
1444 }
1445 
1446 ////////////////////////////////////////////////////////////////////////////////
1447 /// Returns class name of a ROOT object including CINT globals.
1448 
1449 const char *TROOT::FindObjectClassName(const char *name) const
1450 {
1451  // Search first in the list of "standard" objects
1452  TObject *obj = FindObject(name);
1453  if (obj) return obj->ClassName();
1454 
1455  // Is it a global variable?
1456  TGlobal *g = GetGlobal(name);
1457  if (g) return g->GetTypeName();
1458 
1459  return 0;
1460 }
1461 
1462 ////////////////////////////////////////////////////////////////////////////////
1463 /// Return path name of obj somewhere in the //root/... path.
1464 /// The function returns the first occurence of the object in the list
1465 /// of folders. The returned string points to a static char array in TROOT.
1466 /// If this function is called in a loop or recursively, it is the
1467 /// user's responsibility to copy this string in their area.
1468 
1469 const char *TROOT::FindObjectPathName(const TObject *) const
1470 {
1471  Error("FindObjectPathName","Not yet implemented");
1472  return "??";
1473 }
1474 
1475 ////////////////////////////////////////////////////////////////////////////////
1476 /// return a TClass object corresponding to 'name' assuming it is an STL container.
1477 /// In particular we looking for possible alternative name (default template
1478 /// parameter, typedefs template arguments, typedefed name).
1479 
1480 TClass *TROOT::FindSTLClass(const char *name, Bool_t load, Bool_t silent) const
1481 {
1482  // Example of inputs are
1483  // vector<int> (*)
1484  // vector<Int_t>
1485  // vector<long long>
1486  // vector<Long_64_t> (*)
1487  // vector<int, allocator<int> >
1488  // vector<Int_t, allocator<int> >
1489  //
1490  // One of the possibly expensive operation is the resolving of the typedef
1491  // which can provoke the parsing of the header files (and/or the loading
1492  // of clang pcms information).
1493 
1495 
1496  // Remove std::, allocator, typedef, add Long64_t, etc. in just one call.
1497  std::string normalized;
1498  TClassEdit::GetNormalizedName(normalized, name);
1499 
1500  TClass *cl = 0;
1501  if (normalized != name) cl = TClass::GetClass(normalized.c_str(),load,silent);
1502 
1503  if (load && cl==0) {
1504  // Create an Emulated class for this container.
1505  cl = gInterpreter->GenerateTClass(normalized.c_str(), kTRUE, silent);
1506  }
1507 
1508  return cl;
1509 }
1510 
1511 ////////////////////////////////////////////////////////////////////////////////
1512 /// Return pointer to class with name. Obsolete, use TClass::GetClass directly
1513 
1514 TClass *TROOT::GetClass(const char *name, Bool_t load, Bool_t silent) const
1515 {
1516  return TClass::GetClass(name,load,silent);
1517 }
1518 
1519 
1520 ////////////////////////////////////////////////////////////////////////////////
1521 /// Return pointer to class from its name. Obsolete, use TClass::GetClass directly
1522 /// See TClass::GetClass
1523 
1524 TClass *TROOT::GetClass(const std::type_info& typeinfo, Bool_t load, Bool_t silent) const
1525 {
1526  return TClass::GetClass(typeinfo,load,silent);
1527 }
1528 
1529 ////////////////////////////////////////////////////////////////////////////////
1530 /// Return address of color with index color.
1531 
1533 {
1535  TObjArray *lcolors = (TObjArray*) GetListOfColors();
1536  if (!lcolors) return 0;
1537  if (color < 0 || color >= lcolors->GetSize()) return 0;
1538  TColor *col = (TColor*)lcolors->At(color);
1539  if (col && col->GetNumber() == color) return col;
1540  TIter next(lcolors);
1541  while ((col = (TColor *) next()))
1542  if (col->GetNumber() == color) return col;
1543 
1544  return 0;
1545 }
1546 
1547 ////////////////////////////////////////////////////////////////////////////////
1548 /// Return a default canvas.
1549 
1551 {
1552  return (TCanvas*)gROOT->ProcessLine("TCanvas::MakeDefCanvas();");
1553 }
1554 
1555 ////////////////////////////////////////////////////////////////////////////////
1556 /// Return pointer to type with name.
1557 
1558 TDataType *TROOT::GetType(const char *name, Bool_t /* load */) const
1559 {
1560  return (TDataType*)gROOT->GetListOfTypes()->FindObject(name);
1561 }
1562 
1563 ////////////////////////////////////////////////////////////////////////////////
1564 /// Return pointer to file with name.
1565 
1566 TFile *TROOT::GetFile(const char *name) const
1567 {
1569  return (TFile*)GetListOfFiles()->FindObject(name);
1570 }
1571 
1572 ////////////////////////////////////////////////////////////////////////////////
1573 /// Return pointer to style with name
1574 
1575 TStyle *TROOT::GetStyle(const char *name) const
1576 {
1577  return (TStyle*)GetListOfStyles()->FindObject(name);
1578 }
1579 
1580 ////////////////////////////////////////////////////////////////////////////////
1581 /// Return pointer to function with name.
1582 
1583 TObject *TROOT::GetFunction(const char *name) const
1584 {
1585  if (name == 0 || name[0] == 0) {
1586  return 0;
1587  }
1588 
1589  {
1592  if (f1) return f1;
1593  }
1594 
1595  gROOT->ProcessLine("TF1::InitStandardFunctions();");
1596 
1598  return fFunctions->FindObject(name);
1599 }
1600 
1601 ////////////////////////////////////////////////////////////////////////////////
1602 
1604 {
1605  if (!gInterpreter) return 0;
1606 
1608 
1610 }
1611 
1612 ////////////////////////////////////////////////////////////////////////////////
1613 /// Return pointer to global variable by name. If load is true force
1614 /// reading of all currently defined globals from CINT (more expensive).
1615 
1616 TGlobal *TROOT::GetGlobal(const char *name, Bool_t load) const
1617 {
1618  return (TGlobal *)gROOT->GetListOfGlobals(load)->FindObject(name);
1619 }
1620 
1621 ////////////////////////////////////////////////////////////////////////////////
1622 /// Return pointer to global variable with address addr.
1623 
1624 TGlobal *TROOT::GetGlobal(const TObject *addr, Bool_t /* load */) const
1625 {
1626  if (addr == 0 || ((Long_t)addr) == -1) return 0;
1627 
1628  TInterpreter::DeclId_t decl = gInterpreter->GetDataMemberAtAddr(addr);
1629  if (decl) {
1630  TListOfDataMembers *globals = ((TListOfDataMembers*)(gROOT->GetListOfGlobals(kFALSE)));
1631  return (TGlobal*)globals->Get(decl);
1632  }
1633  // If we are actually looking for a global that is held by a global
1634  // pointer (for example gRandom), we need to find a pointer with the
1635  // correct value.
1636  decl = gInterpreter->GetDataMemberWithValue(addr);
1637  if (decl) {
1638  TListOfDataMembers *globals = ((TListOfDataMembers*)(gROOT->GetListOfGlobals(kFALSE)));
1639  return (TGlobal*)globals->Get(decl);
1640  }
1641  return 0;
1642 }
1643 
1644 ////////////////////////////////////////////////////////////////////////////////
1645 /// Internal routine returning, and creating if necessary, the list
1646 /// of global function.
1647 
1649 {
1651  return fGlobalFunctions;
1652 }
1653 
1654 ////////////////////////////////////////////////////////////////////////////////
1655 /// Return the collection of functions named "name".
1656 
1658 {
1659  return ((TListOfFunctions*)fGlobalFunctions)->GetListForObject(name);
1660 }
1661 
1662 ////////////////////////////////////////////////////////////////////////////////
1663 /// Return pointer to global function by name.
1664 /// If params != 0 it will also resolve overloading other it returns the first
1665 /// name match.
1666 /// If params == 0 and load is true force reading of all currently defined
1667 /// global functions from Cling.
1668 /// The param string must be of the form: "3189,\"aap\",1.3".
1669 
1670 TFunction *TROOT::GetGlobalFunction(const char *function, const char *params,
1671  Bool_t load)
1672 {
1673  if (!params) {
1675  return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
1676  } else {
1677  if (!fInterpreter)
1678  Fatal("GetGlobalFunction", "fInterpreter not initialized");
1679 
1681  TInterpreter::DeclId_t decl = gInterpreter->GetFunctionWithValues(0,
1682  function, params,
1683  false);
1684 
1685  if (!decl) return 0;
1686 
1687  TFunction *f = GetGlobalFunctions()->Get(decl);
1688  if (f) return f;
1689 
1690  Error("GetGlobalFunction",
1691  "\nDid not find matching TFunction <%s> with \"%s\".",
1692  function,params);
1693  return 0;
1694  }
1695 }
1696 
1697 ////////////////////////////////////////////////////////////////////////////////
1698 /// Return pointer to global function by name. If proto != 0
1699 /// it will also resolve overloading. If load is true force reading
1700 /// of all currently defined global functions from CINT (more expensive).
1701 /// The proto string must be of the form: "int, char*, float".
1702 
1704  const char *proto, Bool_t load)
1705 {
1706  if (!proto) {
1708  return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
1709  } else {
1710  if (!fInterpreter)
1711  Fatal("GetGlobalFunctionWithPrototype", "fInterpreter not initialized");
1712 
1714  TInterpreter::DeclId_t decl = gInterpreter->GetFunctionWithPrototype(0,
1715  function, proto);
1716 
1717  if (!decl) return 0;
1718 
1719  TFunction *f = GetGlobalFunctions()->Get(decl);
1720  if (f) return f;
1721 
1722  Error("GetGlobalFunctionWithPrototype",
1723  "\nDid not find matching TFunction <%s> with \"%s\".",
1724  function,proto);
1725  return 0;
1726  }
1727 }
1728 
1729 ////////////////////////////////////////////////////////////////////////////////
1730 /// Return pointer to Geometry with name
1731 
1732 TObject *TROOT::GetGeometry(const char *name) const
1733 {
1734  return GetListOfGeometries()->FindObject(name);
1735 }
1736 
1737 ////////////////////////////////////////////////////////////////////////////////
1738 
1740 {
1741  if(!fEnums.load()) {
1743  // Test again just in case, another thread did the work while we were
1744  // waiting.
1745  if (!fEnums.load()) fEnums = new TListOfEnumsWithLock(0);
1746  }
1747  if (load) {
1749  (*fEnums).Load(); // Refresh the list of enums.
1750  }
1751  return fEnums.load();
1752 }
1753 
1754 ////////////////////////////////////////////////////////////////////////////////
1755 
1757 {
1759  if(!fFuncTemplate) {
1761  }
1762  return fFuncTemplate;
1763 }
1764 
1765 ////////////////////////////////////////////////////////////////////////////////
1766 /// Return list containing the TGlobals currently defined.
1767 /// Since globals are created and deleted during execution of the
1768 /// program, we need to update the list of globals every time we
1769 /// execute this method. However, when calling this function in
1770 /// a (tight) loop where no interpreter symbols will be created
1771 /// you can set load=kFALSE (default).
1772 
1774 {
1775  if (!fGlobals) {
1776  fGlobals = new TListOfDataMembers(0);
1777  // We add to the list the "funcky-fake" globals.
1778 
1779  // provide special functor for gROOT, while ROOT::GetROOT() does not return reference
1780  TGlobalMappedFunction::MakeFunctor("gROOT", "TROOT*", ROOT::GetROOT, [] {
1781  ROOT::GetROOT();
1782  return (void *)&ROOT::Internal::gROOTLocal;
1783  });
1784 
1785  TGlobalMappedFunction::MakeFunctor("gPad", "TVirtualPad*", TVirtualPad::Pad);
1786  TGlobalMappedFunction::MakeFunctor("gVirtualX", "TVirtualX*", TVirtualX::Instance);
1788 
1789  // Don't let TGlobalMappedFunction delete our globals, now that we take them.
1793  }
1794 
1795  if (!fInterpreter)
1796  Fatal("GetListOfGlobals", "fInterpreter not initialized");
1797 
1798  if (load) fGlobals->Load();
1799 
1800  return fGlobals;
1801 }
1802 
1803 ////////////////////////////////////////////////////////////////////////////////
1804 /// Return list containing the TFunctions currently defined.
1805 /// Since functions are created and deleted during execution of the
1806 /// program, we need to update the list of functions every time we
1807 /// execute this method. However, when calling this function in
1808 /// a (tight) loop where no interpreter symbols will be created
1809 /// you can set load=kFALSE (default).
1810 
1812 {
1814 
1815  if (!fGlobalFunctions) {
1817  }
1818 
1819  if (!fInterpreter)
1820  Fatal("GetListOfGlobalFunctions", "fInterpreter not initialized");
1821 
1822  // A thread that calls with load==true and a thread that calls with load==false
1823  // will conflict here (the load==true will be updating the list while the
1824  // other is reading it). To solve the problem, we could use a read-write lock
1825  // inside the list itself.
1826  if (load) fGlobalFunctions->Load();
1827 
1828  return fGlobalFunctions;
1829 }
1830 
1831 ////////////////////////////////////////////////////////////////////////////////
1832 /// Return a dynamic list giving access to all TDataTypes (typedefs)
1833 /// currently defined.
1834 ///
1835 /// The list is populated on demand. Calling
1836 /// ~~~ {.cpp}
1837 /// gROOT->GetListOfTypes()->FindObject(nameoftype);
1838 /// ~~~
1839 /// will return the TDataType corresponding to 'nameoftype'. If the
1840 /// TDataType is not already in the list itself and the type does exist,
1841 /// a new TDataType will be created and added to the list.
1842 ///
1843 /// Calling
1844 /// ~~~ {.cpp}
1845 /// gROOT->GetListOfTypes()->ls(); // or Print()
1846 /// ~~~
1847 /// list only the typedefs that have been previously accessed through the
1848 /// list (plus the builtins types).
1849 
1851 {
1852  if (!fInterpreter)
1853  Fatal("GetListOfTypes", "fInterpreter not initialized");
1854 
1855  return fTypes;
1856 }
1857 
1858 
1859 ////////////////////////////////////////////////////////////////////////////////
1860 /// Execute command when system has been idle for idleTimeInSec seconds.
1861 
1862 void TROOT::Idle(UInt_t idleTimeInSec, const char *command)
1863 {
1864  if (!fApplication.load())
1866 
1867  if (idleTimeInSec <= 0)
1868  (*fApplication).RemoveIdleTimer();
1869  else
1870  (*fApplication).SetIdleTimer(idleTimeInSec, command);
1871 }
1872 
1873 ////////////////////////////////////////////////////////////////////////////////
1874 /// Check whether className is a known class, and only autoload
1875 /// if we can. Helper function for TROOT::IgnoreInclude().
1876 
1877 static TClass* R__GetClassIfKnown(const char* className)
1878 {
1879  // Check whether the class is available for auto-loading first:
1880  const char* libsToLoad = gInterpreter->GetClassSharedLibs(className);
1881  TClass* cla = 0;
1882  if (libsToLoad) {
1883  // trigger autoload, and only create TClass in this case.
1884  return TClass::GetClass(className);
1885  } else if (gROOT->GetListOfClasses()
1886  && (cla = (TClass*)gROOT->GetListOfClasses()->FindObject(className))) {
1887  // cla assigned in if statement
1888  } else if (gClassTable->FindObject(className)) {
1889  return TClass::GetClass(className);
1890  }
1891  return cla;
1892 }
1893 
1894 ////////////////////////////////////////////////////////////////////////////////
1895 /// Return 1 if the name of the given include file corresponds to a class that
1896 /// is known to ROOT, e.g. "TLorentzVector.h" versus TLorentzVector.
1897 
1898 Int_t TROOT::IgnoreInclude(const char *fname, const char * /*expandedfname*/)
1899 {
1900  if (fname == 0) return 0;
1901 
1902  TString stem(fname);
1903  // Remove extension if any, ignore files with extension not being .h*
1904  Int_t where = stem.Last('.');
1905  if (where != kNPOS) {
1906  if (stem.EndsWith(".so") || stem.EndsWith(".sl") ||
1907  stem.EndsWith(".dl") || stem.EndsWith(".a") ||
1908  stem.EndsWith(".dll", TString::kIgnoreCase))
1909  return 0;
1910  stem.Remove(where);
1911  }
1912 
1913  TString className = gSystem->BaseName(stem);
1914  TClass* cla = R__GetClassIfKnown(className);
1915  if (!cla) {
1916  // Try again with modifications to the file name:
1917  className = stem;
1918  className.ReplaceAll("/", "::");
1919  className.ReplaceAll("\\", "::");
1920  if (className.Contains(":::")) {
1921  // "C:\dir" becomes "C:::dir".
1922  // fname corresponds to whatever is stated after #include and
1923  // a full path name usually means that it's not a regular #include
1924  // but e.g. a ".L", so we can assume that this is not a header of
1925  // a class in a namespace (a global-namespace class would have been
1926  // detected already before).
1927  return 0;
1928  }
1929  cla = R__GetClassIfKnown(className);
1930  }
1931 
1932  if (!cla) {
1933  return 0;
1934  }
1935 
1936  // cla is valid, check wether it's actually in the header of the same name:
1937  if (cla->GetDeclFileLine() <= 0) return 0; // to a void an error with VisualC++
1938  TString decfile = gSystem->BaseName(cla->GetDeclFileName());
1939  if (decfile != gSystem->BaseName(fname)) {
1940  return 0;
1941  }
1942  return 1;
1943 }
1944 
1945 ////////////////////////////////////////////////////////////////////////////////
1946 /// Initialize operating system interface.
1947 
1949 {
1950  if (gSystem == 0) {
1951 #if defined(R__UNIX)
1952 #if defined(R__HAS_COCOA)
1953  gSystem = new TMacOSXSystem;
1954 #else
1955  gSystem = new TUnixSystem;
1956 #endif
1957 #elif defined(R__WIN32)
1958  gSystem = new TWinNTSystem;
1959 #else
1960  gSystem = new TSystem;
1961 #endif
1962 
1963  if (gSystem->Init())
1964  fprintf(stderr, "Fatal in <TROOT::InitSystem>: can't init operating system layer\n");
1965 
1966  if (!gSystem->HomeDirectory()) {
1967  fprintf(stderr, "Fatal in <TROOT::InitSystem>: HOME directory not set\n");
1968  fprintf(stderr, "Fix this by defining the HOME shell variable\n");
1969  }
1970 
1971  // read default files
1972  gEnv = new TEnv(".rootrc");
1973 
1974  gDebug = gEnv->GetValue("Root.Debug", 0);
1975 
1976  if (!gEnv->GetValue("Root.ErrorHandlers", 1))
1977  gSystem->ResetSignals();
1978 
1979  // The old "Root.ZipMode" had a discrepancy between documentation vs actual meaning.
1980  // Also, a value with the meaning "default" wasn't available. To solved this,
1981  // "Root.ZipMode" was replaced by "Root.CompressionAlgorithm". Warn about usage of
1982  // the old value, if it's set to 0, but silently translate the setting to
1983  // "Root.CompressionAlgorithm" for values > 1.
1984  Int_t oldzipmode = gEnv->GetValue("Root.ZipMode", -1);
1985  if (oldzipmode == 0) {
1986  fprintf(stderr, "Warning in <TROOT::InitSystem>: ignoring old rootrc entry \"Root.ZipMode = 0\"!\n");
1987  } else {
1988  if (oldzipmode == -1 || oldzipmode == 1) {
1989  // Not set or default value, use "default" for "Root.CompressionAlgorithm":
1990  oldzipmode = 0;
1991  }
1992  // else keep the old zipmode (e.g. "3") as "Root.CompressionAlgorithm"
1993  // if "Root.CompressionAlgorithm" isn't set; see below.
1994  }
1995 
1996  Int_t zipmode = gEnv->GetValue("Root.CompressionAlgorithm", oldzipmode);
1997  if (zipmode != 0) R__SetZipMode(zipmode);
1998 
1999  const char *sdeb;
2000  if ((sdeb = gSystem->Getenv("ROOTDEBUG")))
2001  gDebug = atoi(sdeb);
2002 
2003  if (gDebug > 0 && isatty(2))
2004  fprintf(stderr, "Info in <TROOT::InitSystem>: running with gDebug = %d\n", gDebug);
2005 
2006  if (gEnv->GetValue("Root.MemStat", 0))
2008  int msize = gEnv->GetValue("Root.MemStat.size", -1);
2009  int mcnt = gEnv->GetValue("Root.MemStat.cnt", -1);
2010  if (msize != -1 || mcnt != -1)
2011  TStorage::EnableStatistics(msize, mcnt);
2012 
2013  fgMemCheck = gEnv->GetValue("Root.MemCheck", 0);
2014 
2015 #if defined(R__HAS_COCOA)
2016  // create and delete a dummy TUrl so that TObjectStat table does not contain
2017  // objects that are deleted after recording is turned-off (in next line),
2018  // like the TUrl::fgSpecialProtocols list entries which are created in the
2019  // TMacOSXSystem ctor.
2020  { TUrl dummy("/dummy"); }
2021 #endif
2022  TObject::SetObjectStat(gEnv->GetValue("Root.ObjectStat", 0));
2023  }
2024 }
2025 
2026 ////////////////////////////////////////////////////////////////////////////////
2027 /// Load and initialize thread library.
2028 
2030 {
2031  if (gEnv->GetValue("Root.UseThreads", 0) || gEnv->GetValue("Root.EnableThreadSafety", 0)) {
2033  }
2034 }
2035 
2036 ////////////////////////////////////////////////////////////////////////////////
2037 /// Initialize the interpreter. Should be called only after main(),
2038 /// to make sure LLVM/Clang is fully initialized.
2039 
2041 {
2042  // usedToIdentifyRootClingByDlSym is available when TROOT is part of
2043  // rootcling.
2044  if (!dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")
2045  && !dlsym(RTLD_DEFAULT, "usedToIdentifyStaticRoot")) {
2046  // Make sure no llvm symbols are visible before loading libCling. If they
2047  // exist libCling will use those and not ours, causing havoc in the
2048  // interpreter. Look for an extern "C" symbol to avoid mangling; look for a
2049  // symbol from llvm because clang builds on top, so users would likely
2050  // have also their own llvm symbols when providing their own clang.
2051  void *LLVMEnablePrettyStackTraceAddr = 0;
2052  // Can't use gSystem->DynFindSymbol() because that iterates over all *known*
2053  // libraries which is not the same!
2054  LLVMEnablePrettyStackTraceAddr = dlsym(RTLD_DEFAULT, "LLVMEnablePrettyStackTrace");
2055  // FIXME: When we configure with -Dclingtest=On we intentionally export the symbols. Silence this error.
2056  if (LLVMEnablePrettyStackTraceAddr) {
2057  Error("InitInterpreter()", "LLVM SYMBOLS ARE EXPOSED TO CLING! "
2058  "This will cause problems; please hide them or dlopen() them "
2059  "after the call to TROOT::InitInterpreter()!");
2060  }
2061 
2062  char *libRIO = gSystem->DynamicPathName("libRIO");
2063  void *libRIOHandle = dlopen(libRIO, RTLD_NOW|RTLD_GLOBAL);
2064  delete [] libRIO;
2065  if (!libRIOHandle) {
2066  TString err = dlerror();
2067  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load library %s\n", err.Data());
2068  exit(1);
2069  }
2070 
2071  char *libcling = gSystem->DynamicPathName("libCling");
2072  gInterpreterLib = dlopen(libcling, RTLD_LAZY|RTLD_LOCAL);
2073  delete [] libcling;
2074 
2075  if (!gInterpreterLib) {
2076  TString err = dlerror();
2077  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load library %s\n", err.Data());
2078  exit(1);
2079  }
2080  dlerror(); // reset error message
2081  } else {
2082  gInterpreterLib = RTLD_DEFAULT;
2083  }
2085  if (!CreateInterpreter) {
2086  TString err = dlerror();
2087  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load symbol %s\n", err.Data());
2088  exit(1);
2089  }
2090  // Schedule the destruction of TROOT.
2091  atexit(at_exit_of_TROOT);
2092 
2093  gDestroyInterpreter = (DestroyInterpreter_t*) dlsym(gInterpreterLib, "DestroyInterpreter");
2094  if (!gDestroyInterpreter) {
2095  TString err = dlerror();
2096  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load symbol %s\n", err.Data());
2097  exit(1);
2098  }
2099 
2100  const char *interpArgs[] = {
2101 #ifdef NDEBUG
2102  "-DNDEBUG",
2103 #else
2104  "-UNDEBUG",
2105 #endif
2106 #ifdef DEBUG
2107  "-DDEBUG",
2108 #else
2109  "-UDEBUG",
2110 #endif
2111 #ifdef _DEBUG
2112  "-D_DEBUG",
2113 #else
2114  "-U_DEBUG",
2115 #endif
2116  nullptr};
2117 
2119 
2122 
2123  fgRootInit = kTRUE;
2124 
2125  // initialize gClassTable is not already done
2126  if (!gClassTable)
2127  new TClassTable;
2128 
2129  // Initialize all registered dictionaries.
2130  for (std::vector<ModuleHeaderInfo_t>::const_iterator
2131  li = GetModuleHeaderInfoBuffer().begin(),
2132  le = GetModuleHeaderInfoBuffer().end(); li != le; ++li) {
2133  // process buffered module registrations
2134  fInterpreter->RegisterModule(li->fModuleName,
2135  li->fHeaders,
2136  li->fIncludePaths,
2137  li->fPayloadCode,
2138  li->fFwdDeclCode,
2139  li->fTriggerFunc,
2140  li->fFwdNargsToKeepColl,
2141  li->fClassesHeaders,
2142  kTRUE /*lateRegistration*/,
2143  li->fHasCxxModule);
2144  }
2145  GetModuleHeaderInfoBuffer().clear();
2146 
2148 
2149  // Read the rules before enabling the auto loading to not inadvertently
2150  // load the libraries for the classes concerned even-though the user is
2151  // *not* using them.
2152  TClass::ReadRules(); // Read the default customization rules ...
2153 }
2154 
2155 ////////////////////////////////////////////////////////////////////////////////
2156 /// Helper function used by TClass::GetClass().
2157 /// This function attempts to load the dictionary for 'classname'
2158 /// either from the TClassTable or from the list of generator.
2159 /// If silent is 'true', do not warn about missing dictionary for the class.
2160 /// (typically used for class that are used only for transient members)
2161 ///
2162 /// The 'requestedname' is expected to be already normalized.
2163 
2164 TClass *TROOT::LoadClass(const char *requestedname, Bool_t silent) const
2165 {
2166  return TClass::LoadClass(requestedname, silent);
2167 }
2168 
2169 ////////////////////////////////////////////////////////////////////////////////
2170 /// Check if class "classname" is known to the interpreter (in fact,
2171 /// this check is not needed anymore, so classname is ignored). If
2172 /// not it will load library "libname". If the library couldn't be found with original
2173 /// libname and if the name was not prefixed with lib, try to prefix with "lib" and search again.
2174 /// If DynamicPathName still couldn't find the library, return -1.
2175 /// If check is true it will only check if libname exists and is
2176 /// readable.
2177 /// Returns 0 on successful loading, -1 in case libname does not
2178 /// exist or in case of error and -2 in case of version mismatch.
2179 
2180 Int_t TROOT::LoadClass(const char * /*classname*/, const char *libname,
2181  Bool_t check)
2182 {
2183  TString lib(libname);
2184 
2185  // Check if libname exists in path or not
2186  if (char *path = gSystem->DynamicPathName(lib, kTRUE)) {
2187  // If check == true, only check if it exists and if it's readable
2188  if (check) {
2189  delete [] path;
2190  return 0;
2191  }
2192 
2193  // If check == false, try to load the library
2194  else {
2195  int err = gSystem->Load(path, 0, kTRUE);
2196  delete [] path;
2197 
2198  // TSystem::Load returns 1 when the library was already loaded, return success in this case.
2199  if (err == 1)
2200  err = 0;
2201  return err;
2202  }
2203  } else {
2204  // This is the branch where libname didn't exist
2205  if (check) {
2206  FileStat_t stat;
2207  if (!gSystem->GetPathInfo(libname, stat) && (R_ISREG(stat.fMode) &&
2208  !gSystem->AccessPathName(libname, kReadPermission)))
2209  return 0;
2210  }
2211 
2212  // Take care of user who didn't write the whole name
2213  if (!lib.BeginsWith("lib")) {
2214  lib = "lib" + lib;
2215  return LoadClass("", lib.Data(), check);
2216  }
2217  }
2218 
2219  // Execution reaches here when library was prefixed with lib, check is false and couldn't find
2220  // the library name.
2221  return -1;
2222 }
2223 
2224 ////////////////////////////////////////////////////////////////////////////////
2225 /// Return true if the file is local and is (likely) to be a ROOT file
2226 
2227 Bool_t TROOT::IsRootFile(const char *filename) const
2228 {
2229  Bool_t result = kFALSE;
2230  FILE *mayberootfile = fopen(filename,"rb");
2231  if (mayberootfile) {
2232  char header[5];
2233  if (fgets(header,5,mayberootfile)) {
2234  result = strncmp(header,"root",4)==0;
2235  }
2236  fclose(mayberootfile);
2237  }
2238  return result;
2239 }
2240 
2241 ////////////////////////////////////////////////////////////////////////////////
2242 /// To list all objects of the application.
2243 /// Loop on all objects created in the ROOT linked lists.
2244 /// Objects may be files and windows or any other object directly
2245 /// attached to the ROOT linked list.
2246 
2247 void TROOT::ls(Option_t *option) const
2248 {
2249 // TObject::SetDirLevel();
2250 // GetList()->R__FOR_EACH(TObject,ls)(option);
2251  TDirectory::ls(option);
2252 }
2253 
2254 ////////////////////////////////////////////////////////////////////////////////
2255 /// Load a macro in the interpreter's memory. Equivalent to the command line
2256 /// command ".L filename". If the filename has "+" or "++" appended
2257 /// the macro will be compiled by ACLiC. The filename must have the format:
2258 /// [path/]macro.C[+|++[g|O]].
2259 /// The possible error codes are defined by TInterpreter::EErrorCode.
2260 /// If check is true it will only check if filename exists and is
2261 /// readable.
2262 /// Returns 0 on successful loading and -1 in case filename does not
2263 /// exist or in case of error.
2264 
2265 Int_t TROOT::LoadMacro(const char *filename, int *error, Bool_t check)
2266 {
2267  Int_t err = -1;
2268  Int_t lerr, *terr;
2269  if (error)
2270  terr = error;
2271  else
2272  terr = &lerr;
2273 
2274  if (fInterpreter) {
2275  TString aclicMode;
2276  TString arguments;
2277  TString io;
2278  TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
2279 
2280  if (arguments.Length()) {
2281  Warning("LoadMacro", "argument(%s) ignored in %s", arguments.Data(), GetMacroPath());
2282  }
2283  char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
2284  if (!mac) {
2285  if (!check)
2286  Error("LoadMacro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
2287  *terr = TInterpreter::kFatal;
2288  } else {
2289  err = 0;
2290  if (!check) {
2291  fname = mac;
2292  fname += aclicMode;
2293  fname += io;
2294  gInterpreter->LoadMacro(fname.Data(), (TInterpreter::EErrorCode*)terr);
2295  if (*terr)
2296  err = -1;
2297  }
2298  }
2299  delete [] mac;
2300  }
2301  return err;
2302 }
2303 
2304 ////////////////////////////////////////////////////////////////////////////////
2305 /// Execute a macro in the interpreter. Equivalent to the command line
2306 /// command ".x filename". If the filename has "+" or "++" appended
2307 /// the macro will be compiled by ACLiC. The filename must have the format:
2308 /// [path/]macro.C[+|++[g|O]][(args)].
2309 /// The possible error codes are defined by TInterpreter::EErrorCode.
2310 /// If padUpdate is true (default) update the current pad.
2311 /// Returns the macro return value.
2312 
2313 Long_t TROOT::Macro(const char *filename, Int_t *error, Bool_t padUpdate)
2314 {
2315  Long_t result = 0;
2316 
2317  if (fInterpreter) {
2318  TString aclicMode;
2319  TString arguments;
2320  TString io;
2321  TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
2322 
2323  char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
2324  if (!mac) {
2325  Error("Macro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
2326  if (error)
2327  *error = TInterpreter::kFatal;
2328  } else {
2329  fname = mac;
2330  fname += aclicMode;
2331  fname += arguments;
2332  fname += io;
2333  result = gInterpreter->ExecuteMacro(fname, (TInterpreter::EErrorCode*)error);
2334  }
2335  delete [] mac;
2336 
2337  if (padUpdate && gPad)
2338  gPad->Update();
2339  }
2340 
2341  return result;
2342 }
2343 
2344 ////////////////////////////////////////////////////////////////////////////////
2345 /// Process message id called by obj.
2346 
2347 void TROOT::Message(Int_t id, const TObject *obj)
2348 {
2349  TIter next(fMessageHandlers);
2350  TMessageHandler *mh;
2351  while ((mh = (TMessageHandler*)next())) {
2352  mh->HandleMessage(id,obj);
2353  }
2354 }
2355 
2356 ////////////////////////////////////////////////////////////////////////////////
2357 /// Process interpreter command via TApplication::ProcessLine().
2358 /// On Win32 the line will be processed asynchronously by sending
2359 /// it to the CINT interpreter thread. For explicit synchronous processing
2360 /// use ProcessLineSync(). On non-Win32 platforms there is no difference
2361 /// between ProcessLine() and ProcessLineSync().
2362 /// The possible error codes are defined by TInterpreter::EErrorCode. In
2363 /// particular, error will equal to TInterpreter::kProcessing until the
2364 /// CINT interpreted thread has finished executing the line.
2365 /// Returns the result of the command, cast to a Long_t.
2366 
2367 Long_t TROOT::ProcessLine(const char *line, Int_t *error)
2368 {
2369  TString sline = line;
2370  sline = sline.Strip(TString::kBoth);
2371 
2372  if (!fApplication.load())
2374 
2375  return (*fApplication).ProcessLine(sline, kFALSE, error);
2376 }
2377 
2378 ////////////////////////////////////////////////////////////////////////////////
2379 /// Process interpreter command via TApplication::ProcessLine().
2380 /// On Win32 the line will be processed synchronously (i.e. it will
2381 /// only return when the CINT interpreter thread has finished executing
2382 /// the line). On non-Win32 platforms there is no difference between
2383 /// ProcessLine() and ProcessLineSync().
2384 /// The possible error codes are defined by TInterpreter::EErrorCode.
2385 /// Returns the result of the command, cast to a Long_t.
2386 
2388 {
2389  TString sline = line;
2390  sline = sline.Strip(TString::kBoth);
2391 
2392  if (!fApplication.load())
2394 
2395  return (*fApplication).ProcessLine(sline, kTRUE, error);
2396 }
2397 
2398 ////////////////////////////////////////////////////////////////////////////////
2399 /// Process interpreter command directly via CINT interpreter.
2400 /// Only executable statements are allowed (no variable declarations),
2401 /// In all other cases use TROOT::ProcessLine().
2402 /// The possible error codes are defined by TInterpreter::EErrorCode.
2403 
2405 {
2406  TString sline = line;
2407  sline = sline.Strip(TString::kBoth);
2408 
2409  if (!fApplication.load())
2411 
2412  Long_t result = 0;
2413 
2414  if (fInterpreter) {
2416  result = gInterpreter->Calc(sline, code);
2417  }
2418 
2419  return result;
2420 }
2421 
2422 ////////////////////////////////////////////////////////////////////////////////
2423 /// Read Git commit information and branch name from the
2424 /// etc/gitinfo.txt file.
2425 
2427 {
2428 #ifdef ROOT_GIT_COMMIT
2429  fGitCommit = ROOT_GIT_COMMIT;
2430 #endif
2431 #ifdef ROOT_GIT_BRANCH
2432  fGitBranch = ROOT_GIT_BRANCH;
2433 #endif
2434 
2435  TString gitinfo = "gitinfo.txt";
2436  char *filename = gSystem->ConcatFileName(TROOT::GetEtcDir(), gitinfo);
2437 
2438  FILE *fp = fopen(filename, "r");
2439  if (fp) {
2440  TString s;
2441  // read branch name
2442  s.Gets(fp);
2443  fGitBranch = s;
2444  // read commit SHA1
2445  s.Gets(fp);
2446  fGitCommit = s;
2447  // read date/time make was run
2448  s.Gets(fp);
2449  fGitDate = s;
2450  fclose(fp);
2451  }
2452  delete [] filename;
2453 }
2454 
2456  TTHREAD_TLS(Bool_t) fgReadingObject = false;
2457  return fgReadingObject;
2458 }
2459 
2460 ////////////////////////////////////////////////////////////////////////////////
2461 /// Deprecated (will be removed in next release).
2462 
2464 {
2465  return GetReadingObject();
2466 }
2467 
2469 {
2470  GetReadingObject() = flag;
2471 }
2472 
2473 
2474 ////////////////////////////////////////////////////////////////////////////////
2475 /// Return date/time make was run.
2476 
2477 const char *TROOT::GetGitDate()
2478 {
2479  if (fGitDate == "") {
2480  Int_t iday,imonth,iyear, ihour, imin;
2481  static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2482  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
2483  Int_t idate = gROOT->GetBuiltDate();
2484  Int_t itime = gROOT->GetBuiltTime();
2485  iday = idate%100;
2486  imonth = (idate/100)%100;
2487  iyear = idate/10000;
2488  ihour = itime/100;
2489  imin = itime%100;
2490  fGitDate.Form("%s %02d %4d, %02d:%02d:00", months[imonth-1], iday, iyear, ihour, imin);
2491  }
2492  return fGitDate;
2493 }
2494 
2495 ////////////////////////////////////////////////////////////////////////////////
2496 /// Recursively remove this object from the list of Cleanups.
2497 /// Typically RecursiveRemove is implemented by classes that can contain
2498 /// mulitple references to a same object or shared ownership of the object
2499 /// with others.
2500 
2502 {
2504 
2505  fCleanups->RecursiveRemove(obj);
2506 }
2507 
2508 ////////////////////////////////////////////////////////////////////////////////
2509 /// Refresh all browsers. Call this method when some command line
2510 /// command or script has changed the browser contents. Not needed
2511 /// for objects that have the kMustCleanup bit set. Most useful to
2512 /// update browsers that show the file system or other objects external
2513 /// to the running ROOT session.
2514 
2516 {
2517  TIter next(GetListOfBrowsers());
2518  TBrowser *b;
2519  while ((b = (TBrowser*) next()))
2520  b->SetRefreshFlag(kTRUE);
2521 }
2522 ////////////////////////////////////////////////////////////////////////////////
2523 /// Insure that the files, canvases and sockets are closed.
2524 
2525 static void CallCloseFiles()
2526 {
2528  gROOT->CloseFiles();
2529  }
2530 }
2531 
2532 ////////////////////////////////////////////////////////////////////////////////
2533 /// Called by static dictionary initialization to register clang modules
2534 /// for headers. Calls TCling::RegisterModule() unless gCling
2535 /// is NULL, i.e. during startup, where the information is buffered in
2536 /// the static GetModuleHeaderInfoBuffer().
2537 
2538 void TROOT::RegisterModule(const char* modulename,
2539  const char** headers,
2540  const char** includePaths,
2541  const char* payloadCode,
2542  const char* fwdDeclCode,
2543  void (*triggerFunc)(),
2544  const TInterpreter::FwdDeclArgsToKeepCollection_t& fwdDeclsArgToSkip,
2545  const char** classesHeaders,
2546  bool hasCxxModule)
2547 {
2548 
2549  // First a side track to insure proper end of process behavior.
2550 
2551  // Register for each loaded dictionary (and thus for each library),
2552  // that we need to Close the ROOT files as soon as this library
2553  // might start being unloaded after main.
2554  //
2555  // By calling atexit here (rather than directly from within the
2556  // library) we make sure that this is not called if the library is
2557  // 'only' dlclosed.
2558 
2559  // On Ubuntu the linker strips the unused libraries. Eventhough
2560  // stressHistogram is explicitly linked against libNet, it is not
2561  // retained and thus is loaded only as needed in the middle part of
2562  // the execution. Concretely this also means that it is loaded
2563  // *after* the construction of the TApplication object and thus
2564  // after the registration (atexit) of the EndOfProcessCleanups
2565  // routine. Consequently, after the end of main, libNet is
2566  // unloaded before EndOfProcessCleanups is called. When
2567  // EndOfProcessCleanups is executed it indirectly needs the TClass
2568  // for TSocket and its search will use resources that have already
2569  // been unloaded (technically the function static in TUnixSystem's
2570  // DynamicPath and the dictionary from libNet).
2571 
2572  // Similarly, the ordering (before this commit) was broken in the
2573  // following case:
2574 
2575  // TApplication creation (EndOfProcessCleanups registration)
2576  // load UserLibrary
2577  // create TFile
2578  // Append UserObject to TFile
2579 
2580  // and after the end of main the order of execution was
2581 
2582  // unload UserLibrary
2583  // call EndOfProcessCleanups
2584  // Write the TFile
2585  // attempt to write the user object.
2586  // ....
2587 
2588  // where what we need is to have the files closen/written before
2589  // the unloading of the library.
2590 
2591  // To solve the problem we now register an atexit function for
2592  // every dictionary thus making sure there is at least one executed
2593  // before the first library tear down after main.
2594 
2595  // If atexit is called directly within a library's code, the
2596  // function will called *either* when the library is 'dlclose'd or
2597  // after then end of main (whichever comes first). We do *not*
2598  // want the files to be closed whenever a library is unloaded via
2599  // dlclose. To avoid this, we add the function (CallCloseFiles)
2600  // from the dictionary indirectly (via ROOT::RegisterModule). In
2601  // this case the function will only only be called either when
2602  // libCore is 'dlclose'd or right after the end of main.
2603 
2604  atexit(CallCloseFiles);
2605 
2606  // Now register with TCling.
2607  if (TROOT::Initialized()) {
2608  gCling->RegisterModule(modulename, headers, includePaths, payloadCode, fwdDeclCode, triggerFunc,
2609  fwdDeclsArgToSkip, classesHeaders, false, hasCxxModule);
2610  } else {
2611  GetModuleHeaderInfoBuffer().push_back(ModuleHeaderInfo_t(modulename, headers, includePaths, payloadCode,
2612  fwdDeclCode, triggerFunc, fwdDeclsArgToSkip,
2613  classesHeaders, hasCxxModule));
2614  }
2615 }
2616 
2617 ////////////////////////////////////////////////////////////////////////////////
2618 /// Remove an object from the in-memory list.
2619 /// Since TROOT is global resource, this is lock protected.
2620 
2622 {
2624  return TDirectory::Remove(obj);
2625 }
2626 
2627 ////////////////////////////////////////////////////////////////////////////////
2628 /// Remove a class from the list and map of classes.
2629 /// This routine is deprecated, use TClass::RemoveClass directly.
2630 
2632 {
2633  TClass::RemoveClass(oldcl);
2634 }
2635 
2636 ////////////////////////////////////////////////////////////////////////////////
2637 /// Delete all global interpreter objects created since the last call to Reset
2638 ///
2639 /// If option="a" is set reset to startup context (i.e. unload also
2640 /// all loaded files, classes, structs, typedefs, etc.).
2641 ///
2642 /// This function is typically used at the beginning (or end) of an unnamed macro
2643 /// to clean the environment.
2644 ///
2645 /// IMPORTANT WARNING:
2646 /// Do not use this call from within any function (neither compiled nor
2647 /// interpreted. This should only be used from a unnamed macro
2648 /// (which starts with a { (curly braces) ). For example, using TROOT::Reset
2649 /// from within an interpreted function will lead to the unloading of the
2650 /// dictionary and source file, including the one defining the function being
2651 /// executed.
2652 ///
2653 
2654 void TROOT::Reset(Option_t *option)
2655 {
2656  if (IsExecutingMacro()) return; //True when TMacro::Exec runs
2657  if (fInterpreter) {
2658  if (!strncmp(option, "a", 1)) {
2659  fInterpreter->Reset();
2661  } else
2662  gInterpreter->ResetGlobals();
2663 
2664  if (fGlobals) fGlobals->Unload();
2666 
2667  SaveContext();
2668  }
2669 }
2670 
2671 ////////////////////////////////////////////////////////////////////////////////
2672 /// Save the current interpreter context.
2673 
2675 {
2676  if (fInterpreter)
2677  gInterpreter->SaveGlobalsContext();
2678 }
2679 
2680 ////////////////////////////////////////////////////////////////////////////////
2681 /// Set the default graphical cut class name for the graphics editor
2682 /// By default the graphics editor creates an instance of a class TCutG.
2683 /// This function may be called to specify a different class that MUST
2684 /// derive from TCutG
2685 
2686 void TROOT::SetCutClassName(const char *name)
2687 {
2688  if (!name) {
2689  Error("SetCutClassName","Invalid class name");
2690  return;
2691  }
2692  TClass *cl = TClass::GetClass(name);
2693  if (!cl) {
2694  Error("SetCutClassName","Unknown class:%s",name);
2695  return;
2696  }
2697  if (!cl->InheritsFrom("TCutG")) {
2698  Error("SetCutClassName","Class:%s does not derive from TCutG",name);
2699  return;
2700  }
2701  fCutClassName = name;
2702 }
2703 
2704 ////////////////////////////////////////////////////////////////////////////////
2705 /// Set editor mode
2706 
2707 void TROOT::SetEditorMode(const char *mode)
2708 {
2709  fEditorMode = 0;
2710  if (!mode[0]) return;
2711  if (!strcmp(mode,"Arc")) {fEditorMode = kArc; return;}
2712  if (!strcmp(mode,"Line")) {fEditorMode = kLine; return;}
2713  if (!strcmp(mode,"Arrow")) {fEditorMode = kArrow; return;}
2714  if (!strcmp(mode,"Button")) {fEditorMode = kButton; return;}
2715  if (!strcmp(mode,"Diamond")) {fEditorMode = kDiamond; return;}
2716  if (!strcmp(mode,"Ellipse")) {fEditorMode = kEllipse; return;}
2717  if (!strcmp(mode,"Pad")) {fEditorMode = kPad; return;}
2718  if (!strcmp(mode,"Pave")) {fEditorMode = kPave; return;}
2719  if (!strcmp(mode,"PaveLabel")){fEditorMode = kPaveLabel; return;}
2720  if (!strcmp(mode,"PaveText")) {fEditorMode = kPaveText; return;}
2721  if (!strcmp(mode,"PavesText")){fEditorMode = kPavesText; return;}
2722  if (!strcmp(mode,"PolyLine")) {fEditorMode = kPolyLine; return;}
2723  if (!strcmp(mode,"CurlyLine")){fEditorMode = kCurlyLine; return;}
2724  if (!strcmp(mode,"CurlyArc")) {fEditorMode = kCurlyArc; return;}
2725  if (!strcmp(mode,"Text")) {fEditorMode = kText; return;}
2726  if (!strcmp(mode,"Marker")) {fEditorMode = kMarker; return;}
2727  if (!strcmp(mode,"CutG")) {fEditorMode = kCutG; return;}
2728 }
2729 
2730 ////////////////////////////////////////////////////////////////////////////////
2731 /// Change current style to style with name stylename
2732 
2733 void TROOT::SetStyle(const char *stylename)
2734 {
2735  TString style_name = stylename;
2736 
2737  TStyle *style = GetStyle(style_name);
2738  if (style) style->cd();
2739  else Error("SetStyle","Unknown style:%s",style_name.Data());
2740 }
2741 
2742 
2743 //-------- Static Member Functions ---------------------------------------------
2744 
2745 
2746 ////////////////////////////////////////////////////////////////////////////////
2747 /// Decrease the indentation level for ls().
2748 
2750 {
2751  return --fgDirLevel;
2752 }
2753 
2754 ////////////////////////////////////////////////////////////////////////////////
2755 ///return directory level
2756 
2758 {
2759  return fgDirLevel;
2760 }
2761 
2762 ////////////////////////////////////////////////////////////////////////////////
2763 /// Get macro search path. Static utility function.
2764 
2765 const char *TROOT::GetMacroPath()
2766 {
2767  TString &macroPath = ROOT::GetMacroPath();
2768 
2769  if (macroPath.Length() == 0) {
2770  macroPath = gEnv->GetValue("Root.MacroPath", (char*)0);
2771 #if defined(R__WIN32)
2772  macroPath.ReplaceAll("; ", ";");
2773 #else
2774  macroPath.ReplaceAll(": ", ":");
2775 #endif
2776  if (macroPath.Length() == 0)
2777 #if !defined(R__WIN32)
2778  macroPath = ".:" + TROOT::GetMacroDir();
2779 #else
2780  macroPath = ".;" + TROOT::GetMacroDir();
2781 #endif
2782  }
2783 
2784  return macroPath;
2785 }
2786 
2787 ////////////////////////////////////////////////////////////////////////////////
2788 /// Set or extend the macro search path. Static utility function.
2789 /// If newpath=0 or "" reset to value specified in the rootrc file.
2790 
2791 void TROOT::SetMacroPath(const char *newpath)
2792 {
2793  TString &macroPath = ROOT::GetMacroPath();
2794 
2795  if (!newpath || !*newpath)
2796  macroPath = "";
2797  else
2798  macroPath = newpath;
2799 }
2800 
2801 ////////////////////////////////////////////////////////////////////////////////
2802 /// \brief Specify where web graphics shall be rendered
2803 ///
2804 /// The input parameter `webdisplay` defines where web graphics is rendered.
2805 /// `webdisplay` parameter may contain:
2806 ///
2807 /// - "off": turns off the web display and comes back to normal graphics in
2808 /// interactive mode.
2809 /// - "batch": turns the web display in batch mode. It can be prepended with
2810 /// another string which is considered as the new current web display.
2811 /// - "nobatch": turns the web display in interactive mode. It can be
2812 /// prepended with another string which is considered as the new current web display.
2813 ///
2814 /// If the option "off" is not set, this method turns the normal graphics to
2815 /// "Batch" to avoid the loading of local graphics libraries.
2816 
2817 void TROOT::SetWebDisplay(const char *webdisplay)
2818 {
2819  const char *wd = webdisplay;
2820  if (!wd)
2821  wd = "";
2822 
2823  if (!strcmp(wd, "off")) {
2826  fWebDisplay = "";
2827  } else {
2828  fIsWebDisplay = kTRUE;
2829  if (!strncmp(wd, "batch", 5)) {
2831  wd += 5;
2832  } else if (!strncmp(wd, "nobatch", 7)) {
2834  wd += 7;
2835  } else {
2837  }
2838  fWebDisplay = wd;
2839  }
2840 }
2841 
2842 ////////////////////////////////////////////////////////////////////////////////
2843 /// Increase the indentation level for ls().
2844 
2846 {
2847  return ++fgDirLevel;
2848 }
2849 
2850 ////////////////////////////////////////////////////////////////////////////////
2851 /// Functions used by ls() to indent an object hierarchy.
2852 
2854 {
2855  for (int i = 0; i < fgDirLevel; i++) std::cout.put(' ');
2856 }
2857 
2858 ////////////////////////////////////////////////////////////////////////////////
2859 /// Return kTRUE if the TROOT object has been initialized.
2860 
2862 {
2863  return fgRootInit;
2864 }
2865 
2866 ////////////////////////////////////////////////////////////////////////////////
2867 /// Return kTRUE if the memory leak checker is on.
2868 
2870 {
2871  return fgMemCheck;
2872 }
2873 
2874 ////////////////////////////////////////////////////////////////////////////////
2875 /// Return Indentation level for ls().
2876 
2878 {
2879  fgDirLevel = level;
2880 }
2881 
2882 ////////////////////////////////////////////////////////////////////////////////
2883 /// Convert version code to an integer, i.e. 331527 -> 51507.
2884 
2886 {
2887  return 10000*(code>>16) + 100*((code&65280)>>8) + (code&255);
2888 }
2889 
2890 ////////////////////////////////////////////////////////////////////////////////
2891 /// Convert version as an integer to version code as used in RVersion.h.
2892 
2894 {
2895  int a = v/10000;
2896  int b = (v - a*10000)/100;
2897  int c = v - a*10000 - b*100;
2898  return (a << 16) + (b << 8) + c;
2899 }
2900 
2901 ////////////////////////////////////////////////////////////////////////////////
2902 /// Return ROOT version code as defined in RVersion.h.
2903 
2905 {
2906  return ROOT_VERSION_CODE;
2907 }
2908 ////////////////////////////////////////////////////////////////////////////////
2909 /// Provide command line arguments to the interpreter construction.
2910 /// These arguments are added to the existing flags (e.g. `-DNDEBUG`).
2911 /// They are evaluated once per process, at the time where TROOT (and thus
2912 /// TInterpreter) is constructed.
2913 /// Returns the new flags.
2914 
2915 const std::vector<std::string> &TROOT::AddExtraInterpreterArgs(const std::vector<std::string> &args) {
2916  static std::vector<std::string> sArgs = {};
2917  sArgs.insert(sArgs.begin(), args.begin(), args.end());
2918  return sArgs;
2919 }
2920 
2921 ////////////////////////////////////////////////////////////////////////////////
2922 /// INTERNAL function!
2923 /// Used by rootcling to inject interpreter arguments through a C-interface layer.
2924 
2926  static const char** extraInterpArgs = 0;
2927  return extraInterpArgs;
2928 }
2929 
2930 ////////////////////////////////////////////////////////////////////////////////
2931 
2932 #ifdef ROOTPREFIX
2933 static Bool_t IgnorePrefix() {
2934  static Bool_t ignorePrefix = gSystem->Getenv("ROOTIGNOREPREFIX");
2935  return ignorePrefix;
2936 }
2937 #endif
2938 
2939 ////////////////////////////////////////////////////////////////////////////////
2940 /// Get the rootsys directory in the installation. Static utility function.
2941 
2943  // Avoid returning a reference to a temporary because of the conversion
2944  // between std::string and TString.
2945  const static TString rootsys = ROOT::FoundationUtils::GetRootSys();
2946  return rootsys;
2947 }
2948 
2949 ////////////////////////////////////////////////////////////////////////////////
2950 /// Get the binary directory in the installation. Static utility function.
2951 
2953 #ifdef ROOTBINDIR
2954  if (IgnorePrefix()) {
2955 #endif
2956  static TString rootbindir;
2957  if (rootbindir.IsNull()) {
2958  rootbindir = "bin";
2959  gSystem->PrependPathName(GetRootSys(), rootbindir);
2960  }
2961  return rootbindir;
2962 #ifdef ROOTBINDIR
2963  } else {
2964  const static TString rootbindir = ROOTBINDIR;
2965  return rootbindir;
2966  }
2967 #endif
2968 }
2969 
2970 ////////////////////////////////////////////////////////////////////////////////
2971 /// Get the library directory in the installation. Static utility function.
2972 
2974 #ifdef ROOTLIBDIR
2975  if (IgnorePrefix()) {
2976 #endif
2977  static TString rootlibdir;
2978  if (rootlibdir.IsNull()) {
2979  rootlibdir = "lib";
2980  gSystem->PrependPathName(GetRootSys(), rootlibdir);
2981  }
2982  return rootlibdir;
2983 #ifdef ROOTLIBDIR
2984  } else {
2985  const static TString rootlibdir = ROOTLIBDIR;
2986  return rootlibdir;
2987  }
2988 #endif
2989 }
2990 
2991 ////////////////////////////////////////////////////////////////////////////////
2992 /// Get the include directory in the installation. Static utility function.
2993 
2995  // Avoid returning a reference to a temporary because of the conversion
2996  // between std::string and TString.
2997  const static TString includedir = ROOT::FoundationUtils::GetIncludeDir();
2998  return includedir;
2999 }
3000 
3001 ////////////////////////////////////////////////////////////////////////////////
3002 /// Get the sysconfig directory in the installation. Static utility function.
3003 
3005  // Avoid returning a reference to a temporary because of the conversion
3006  // between std::string and TString.
3007  const static TString etcdir = ROOT::FoundationUtils::GetEtcDir();
3008  return etcdir;
3009 }
3010 
3011 ////////////////////////////////////////////////////////////////////////////////
3012 /// Get the data directory in the installation. Static utility function.
3013 
3015 #ifdef ROOTDATADIR
3016  if (IgnorePrefix()) {
3017 #endif
3018  return GetRootSys();
3019 #ifdef ROOTDATADIR
3020  } else {
3021  const static TString rootdatadir = ROOTDATADIR;
3022  return rootdatadir;
3023  }
3024 #endif
3025 }
3026 
3027 ////////////////////////////////////////////////////////////////////////////////
3028 /// Get the documentation directory in the installation. Static utility function.
3029 
3031 #ifdef ROOTDOCDIR
3032  if (IgnorePrefix()) {
3033 #endif
3034  return GetRootSys();
3035 #ifdef ROOTDOCDIR
3036  } else {
3037  const static TString rootdocdir = ROOTDOCDIR;
3038  return rootdocdir;
3039  }
3040 #endif
3041 }
3042 
3043 ////////////////////////////////////////////////////////////////////////////////
3044 /// Get the macro directory in the installation. Static utility function.
3045 
3047 #ifdef ROOTMACRODIR
3048  if (IgnorePrefix()) {
3049 #endif
3050  static TString rootmacrodir;
3051  if (rootmacrodir.IsNull()) {
3052  rootmacrodir = "macros";
3053  gSystem->PrependPathName(GetRootSys(), rootmacrodir);
3054  }
3055  return rootmacrodir;
3056 #ifdef ROOTMACRODIR
3057  } else {
3058  const static TString rootmacrodir = ROOTMACRODIR;
3059  return rootmacrodir;
3060  }
3061 #endif
3062 }
3063 
3064 ////////////////////////////////////////////////////////////////////////////////
3065 /// Get the tutorials directory in the installation. Static utility function.
3066 
3068 #ifdef ROOTTUTDIR
3069  if (IgnorePrefix()) {
3070 #endif
3071  static TString roottutdir;
3072  if (roottutdir.IsNull()) {
3073  roottutdir = "tutorials";
3074  gSystem->PrependPathName(GetRootSys(), roottutdir);
3075  }
3076  return roottutdir;
3077 #ifdef ROOTTUTDIR
3078  } else {
3079  const static TString roottutdir = ROOTTUTDIR;
3080  return roottutdir;
3081  }
3082 #endif
3083 }
3084 
3085 ////////////////////////////////////////////////////////////////////////////////
3086 /// Shut down ROOT.
3087 
3089 {
3090  if (gROOT)
3091  gROOT->EndOfProcessCleanups();
3092  else if (gInterpreter)
3093  gInterpreter->ShutDown();
3094 }
3095 
3096 ////////////////////////////////////////////////////////////////////////////////
3097 /// Get the source directory in the installation. Static utility function.
3098 
3100 #ifdef ROOTSRCDIR
3101  if (IgnorePrefix()) {
3102 #endif
3103  static TString rootsrcdir;
3104  if (rootsrcdir.IsNull()) {
3105  rootsrcdir = "src";
3106  gSystem->PrependPathName(GetRootSys(), rootsrcdir);
3107  }
3108  return rootsrcdir;
3109 #ifdef ROOTSRCDIR
3110  } else {
3111  const static TString rootsrcdir = ROOTSRCDIR;
3112  return rootsrcdir;
3113  }
3114 #endif
3115 }
3116 
3117 ////////////////////////////////////////////////////////////////////////////////
3118 /// Get the icon path in the installation. Static utility function.
3119 
3121 #ifdef ROOTICONPATH
3122  if (IgnorePrefix()) {
3123 #endif
3124  static TString rooticonpath;
3125  if (rooticonpath.IsNull()) {
3126  rooticonpath = "icons";
3127  gSystem->PrependPathName(GetRootSys(), rooticonpath);
3128  }
3129  return rooticonpath;
3130 #ifdef ROOTICONPATH
3131  } else {
3132  const static TString rooticonpath = ROOTICONPATH;
3133  return rooticonpath;
3134  }
3135 #endif
3136 }
3137 
3138 ////////////////////////////////////////////////////////////////////////////////
3139 /// Get the fonts directory in the installation. Static utility function.
3140 
3142 #ifdef TTFFONTDIR
3143  if (IgnorePrefix()) {
3144 #endif
3145  static TString ttffontdir;
3146  if (ttffontdir.IsNull()) {
3147  ttffontdir = "fonts";
3148  gSystem->PrependPathName(GetRootSys(), ttffontdir);
3149  }
3150  return ttffontdir;
3151 #ifdef TTFFONTDIR
3152  } else {
3153  const static TString ttffontdir = TTFFONTDIR;
3154  return ttffontdir;
3155  }
3156 #endif
3157 }
3158 
3159 ////////////////////////////////////////////////////////////////////////////////
3160 /// Get the tutorials directory in the installation. Static utility function.
3161 /// Backward compatibility function - do not use for new code
3162 
3163 const char *TROOT::GetTutorialsDir() {
3164  return GetTutorialDir();
3165 }
TSeqCollection * fStreamerInfo
Definition: TROOT.h:169
const char * FindObjectPathName(const TObject *obj) const
Return path name of obj somewhere in the //root/...
Definition: TROOT.cxx:1469
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:934
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:1279
Bool_t fExecutingMacro
Definition: TROOT.h:146
void AddClass(TClass *cl)
Add a class to the list and map of classes.
Definition: TROOT.cxx:1045
virtual void Add(TObject *obj)
TListOfFunctionTemplates * fFuncTemplate
Definition: TROOT.h:152
UInt_t GetImplicitMTPoolSize()
Returns the size of the pool used for implicit multi-threading.
Definition: TROOT.cxx:618
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
Definition: TROOT.cxx:3141
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:30
TCanvas * MakeDefCanvas() const
Return a default canvas.
Definition: TROOT.cxx:1550
R__EXTERN TGuiFactory * gBatchGuiFactory
Definition: TGuiFactory.h:67
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:53
An array of TObjects.
Definition: TObjArray.h:37
virtual void Clear(Option_t *option="")=0
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Definition: TROOT.cxx:2749
const std::string & GetIncludeDir()
\ returns the include directory in the installation.
static Bool_t BlockAllSignals(Bool_t b)
Block or unblock all signals. Returns the previous block status.
Definition: TQObject.cxx:1055
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:467
TFolder * fRootFolder
Definition: TROOT.h:177
TCollection * GetListOfEnums(Bool_t load=kFALSE)
Definition: TROOT.cxx:1739
ROOT top level object description.
Definition: TROOT.h:102
static const TString & GetMacroDir()
Get the macro directory in the installation. Static utility function.
Definition: TROOT.cxx:3046
void * DestroyInterpreter_t(TInterpreter *)
Definition: TInterpreter.h:552
This class is a specialized TProcessID managing the list of UUIDs.
Definition: TProcessUUID.h:32
TSeqCollection * fProofs
Definition: TROOT.h:172
static const TString & GetTutorialDir()
Get the tutorials directory in the installation. Static utility function.
Definition: TROOT.cxx:3067
static constexpr double mm
void RemoveClass(TClass *)
Remove a class from the list and map of classes.
Definition: TROOT.cxx:2631
TCollection * GetListOfGlobalFunctions(Bool_t load=kFALSE)
Return list containing the TFunctions currently defined.
Definition: TROOT.cxx:1811
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:871
Int_t LoadMacro(const char *filename, Int_t *error=0, Bool_t check=kFALSE)
Load a macro in the interpreter&#39;s memory.
Definition: TROOT.cxx:2265
VSD Structures.
Definition: StringConv.hxx:21
static const char **& GetExtraInterpreterArgs()
INTERNAL function! Used by rootcling to inject interpreter arguments through a C-interface layer...
Definition: TROOT.cxx:2925
TLine * line
TSeqCollection * fGeometries
Definition: TROOT.h:164
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:95
Handle messages that might be generated by the system.
TDictionary::DeclId_t DeclId_t
Definition: TInterpreter.h:283
const char Option_t
Definition: RtypesCore.h:62
Dictionary for function template This class describes one single function template.
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:4209
void DisableImplicitMT()
Disables the implicit multi-threading in ROOT (see EnableImplicitMT).
Definition: TROOT.cxx:597
static TVirtualX *& Instance()
Returns gVirtualX global.
Definition: TVirtualX.cxx:57
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
Short_t GetDeclFileLine() const
Definition: TClass.h:396
#define ROOT_RELEASE_TIME
Definition: RVersion.h:19
TList * fList
Definition: TDirectory.h:90
#define g(i)
Definition: RSha256.hxx:105
static const TString & GetIconPath()
Get the icon path in the installation. Static utility function.
Definition: TROOT.cxx:3120
R__EXTERN TVirtualMutex * gInterpreterMutex
Definition: TInterpreter.h:40
const Ssiz_t kNPOS
Definition: RtypesCore.h:111
This class represents a WWW compatible URL.
Definition: TUrl.h:35
Int_t fVersionDate
Definition: TROOT.h:125
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:687
Definition: Buttons.h:33
R__EXTERN TStyle * gStyle
Definition: TStyle.h:407
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:1381
Bool_t fForceStyle
Definition: TROOT.h:143
virtual void HandleMessage(Int_t id, const TObject *obj)
Store message origin, keep statistics and call Notify().
Bool_t ReadingObject() const
Deprecated (will be removed in next release).
Definition: TROOT.cxx:2463
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
static Int_t RootVersionCode()
Return ROOT version code as defined in RVersion.h.
Definition: TROOT.cxx:2904
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TInterpreter * CreateInterpreter_t(void *shlibHandle, const char *argv[])
Definition: TInterpreter.h:551
static Bool_t MemCheck()
Return kTRUE if the memory leak checker is on.
Definition: TROOT.cxx:2869
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:48
TString fVersion
Definition: TROOT.h:122
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Definition: TCanvas.cxx:696
void R__SetZipMode(int)
virtual const char * HomeDirectory(const char *userName=0)
Return the user&#39;s home directory.
Definition: TSystem.cxx:887
#define ROOT_RELEASE_DATE
Definition: RVersion.h:18
virtual void AddAll(const TCollection *col)
Add all objects from collection col to this collection.
static void SetObjectStat(Bool_t stat)
Turn on/off tracking of objects in the TObjectTable.
Definition: TObject.cxx:961
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, bool hasCxxModule=false)
Called by static dictionary initialization to register clang modules for headers. ...
Definition: TROOT.cxx:2538
This class implements a mutex interface.
Definition: TVirtualMutex.h:34
void DisableParTreeProcessing()
Globally disables the IMT use case of parallel branch processing, deactivating the corresponding lock...
Definition: TROOT.cxx:482
void InitInterpreter()
Initialize the interpreter.
Definition: TROOT.cxx:2040
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
Definition: TROOT.cxx:611
#define gROOT
Definition: TROOT.h:414
void LoadHandlersFromEnv(TEnv *env)
Load plugin handlers specified in config file, like: Plugin.TSQLServer: ^mysql: TMySQLServer MyS...
TROOT * GetROOT2()
Definition: TROOT.cxx:384
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1836
The TEnv class reads config files, by default named .rootrc.
Definition: TEnv.h:125
Basic string class.
Definition: TString.h:131
void RefreshBrowsers()
Refresh all browsers.
Definition: TROOT.cxx:2515
static Func_t GetSymInLibImt(const char *funcname)
Definition: TROOT.cxx:398
#define f(i)
Definition: RSha256.hxx:104
TString & GetMacroPath()
Definition: TROOT.cxx:524
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
Definition: TInterpreter.h:133
static const TString & GetRootSys()
Get the rootsys directory in the installation. Static utility function.
Definition: TROOT.cxx:2942
#define gInterpreter
Definition: TInterpreter.h:555
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1529
Int_t fVersionCode
Definition: TROOT.h:124
Option_t * GetOption() const
Definition: TCollection.h:251
void Reset(Option_t *option="")
Delete all global interpreter objects created since the last call to Reset.
Definition: TROOT.cxx:2654
Definition: Buttons.h:30
void Load()
Load all the DataMembers known to the interpreter for the scope &#39;fClass&#39; into this collection...
void SetName(const char *newname) override
Set the name for directory If the directory name is changed after the directory was written once...
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:36
STL namespace.
#define ROOT_VERSION_CODE
Definition: RVersion.h:21
static Bool_t & IsImplicitMTEnabledImpl()
Keeps track of the status of ImplicitMT w/o resorting to the load of libImt.
Definition: TROOT.cxx:511
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at this folder.
Definition: TFolder.cxx:352
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
virtual void ResetSignals()
Reset signals handlers to previous behaviour.
Definition: TSystem.cxx:594
std::atomic< TApplication * > fApplication
Definition: TROOT.h:133
void SetStyle(const char *stylename="Default")
Change current style to style with name stylename.
Definition: TROOT.cxx:2733
TDataType * GetType(const char *name, Bool_t load=kFALSE) const
Return pointer to type with name.
Definition: TROOT.cxx:1558
TCollection * GetListOfGlobals(Bool_t load=kFALSE)
Return list containing the TGlobals currently defined.
Definition: TROOT.cxx:1773
TString fGitCommit
Definition: TROOT.h:129
TStyle * GetStyle(const char *name) const
Return pointer to style with name.
Definition: TROOT.cxx:1575
void ls(Option_t *option="") const
To list all objects of the application.
Definition: TROOT.cxx:2247
void BuildDirectory(TFile *motherFile, TDirectory *motherDir)
Initialise directory to defaults.
Definition: TDirectory.cxx:237
static const TString & GetIncludeDir()
Get the include directory in the installation. Static utility function.
Definition: TROOT.cxx:2994
TROOT * GetROOT1()
Definition: TROOT.cxx:377
TObject * Remove(TObject *)
Remove an object from the in-memory list.
Definition: TROOT.cxx:2621
Bool_t R_ISREG(Int_t mode)
Definition: TSystem.h:119
virtual void AddLast(TObject *obj)
Add object at the end of the list.
Definition: TList.cxx:149
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
TString fCutClassName
Definition: TROOT.h:180
Bool_t & GetReadingObject()
Definition: TROOT.cxx:2455
static const char * GetTutorialsDir()
Get the tutorials directory in the installation.
Definition: TROOT.cxx:3163
TListOfFunctions * GetGlobalFunctions()
Internal routine returning, and creating if necessary, the list of global function.
Definition: TROOT.cxx:1648
static Int_t fgDirLevel
Definition: TROOT.h:110
Definition: Buttons.h:30
static const char * GetMacroPath()
Get macro search path. Static utility function.
Definition: TROOT.cxx:2765
TInterpreter * fInterpreter
Definition: TROOT.h:134
Int_t fMode
Definition: TSystem.h:128
static TList & GetEarlyRegisteredGlobals()
Returns list collected globals Used to storeTGlobalMappedFunctions from other libs, before gROOT was initialized.
Definition: TGlobal.cxx:185
const char * GetGitDate()
Return date/time make was run.
Definition: TROOT.cxx:2477
AListOfEnums_t fEnums
Definition: TROOT.h:175
TObject * GetFunction(const char *name) const
Return pointer to function with name.
Definition: TROOT.cxx:1583
TSeqCollection * fMappedFiles
Definition: TROOT.h:157
virtual void Delete(Option_t *option="")=0
Delete this object.
void ls(Option_t *option="") const override
List Directory contents.
Sequenceable collection abstract base class.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
static void * gInterpreterLib
Definition: TROOT.cxx:176
TVirtualMutex * gROOTMutex
Definition: TROOT.cxx:179
THashTable implements a hash table to store TObject&#39;s.
Definition: THashTable.h:35
static const std::vector< std::string > & AddExtraInterpreterArgs(const std::vector< std::string > &args)
Provide command line arguments to the interpreter construction.
Definition: TROOT.cxx:2915
static TVirtualPad *& Pad()
Return the current pad for the current thread.
Definition: TVirtualPad.cxx:28
Int_t fVersionInt
Definition: TROOT.h:123
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
Bool_t IsParTreeProcessingEnabled()
Returns true if parallel tree processing is enabled.
Definition: TROOT.cxx:495
void SetEditorMode(const char *mode="")
Set editor mode.
Definition: TROOT.cxx:2707
static Int_t ReadRules()
Read the class.rules files from the default location:.
Definition: TClass.cxx:1750
TSeqCollection * fCleanups
Definition: TROOT.h:167
Int_t fEditorMode
Definition: TROOT.h:147
Bool_t fMustClean
Definition: TROOT.h:141
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
Definition: TROOT.cxx:2861
void EndOfProcessCleanups()
Execute the cleanups necessary at the end of the process, in particular those that must be executed b...
Definition: TROOT.cxx:1247
R__DLLEXPORT TInterpreter * CreateInterpreter(void *interpLibHandle, const char *argv[])
Definition: TCling.cxx:603
static Bool_t fgRootInit
Definition: TROOT.h:111
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at //root.
Definition: TROOT.cxx:1422
Long_t ProcessLineSync(const char *line, Int_t *error=0)
Process interpreter command via TApplication::ProcessLine().
Definition: TROOT.cxx:2387
void Message(Int_t id, const TObject *obj)
Process message id called by obj.
Definition: TROOT.cxx:2347
void EnableParTreeProcessing()
Globally enables the parallel tree processing, which is a case of implicit multi-threading in ROOT...
Definition: TROOT.cxx:466
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1645
static const TString & GetDocDir()
Get the documentation directory in the installation. Static utility function.
Definition: TROOT.cxx:3030
TCollection * GetListOfFunctionTemplates()
Definition: TROOT.cxx:1756
static void CreateApplication()
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Definition: TSystem.cxx:1064
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2177
static Int_t ITIMQQ(const char *time)
Return built time as integer (with min precision), i.e.
Definition: TROOT.cxx:220
void SaveContext()
Save the current interpreter context.
Definition: TROOT.cxx:2674
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
Definition: TDirectory.cxx:584
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:400
virtual void Delete(Option_t *option="")
Delete all TFunction object files.
R__EXTERN TVirtualRWMutex * gCoreMutex
virtual bool UseRWLock()
Set this collection to use a RW lock upon access, making it thread safe.
virtual TList * GetList() const
Definition: TDirectory.h:159
static constexpr double s
TCollection * GetListOfFunctionOverloads(const char *name) const
Return the collection of functions named "name".
Definition: TROOT.cxx:1657
TString fWebDisplay
Definition: TROOT.h:136
static void at_exit_of_TROOT()
Definition: TROOT.cxx:295
TSeqCollection * fClipboard
Definition: TROOT.h:173
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:186
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:49
R__EXTERN TGuiFactory * gGuiFactory
Definition: TGuiFactory.h:66
static void Cleanup()
static function (called by TROOT destructor) to delete all TProcessIDs
Definition: TProcessID.cxx:202
void Error(const char *location, const char *msgfmt,...)
R__EXTERN TPluginManager * gPluginMgr
Definition: Buttons.h:38
virtual void RegisterModule(const char *, const char **, const char **, const char *, const char *, void(*)(), const FwdDeclArgsToKeepCollection_t &fwdDeclArgsToKeep, const char **classesHeaders, Bool_t lateRegistration=false, Bool_t hasCxxModule=false)=0
Bool_t fEscape
Definition: TROOT.h:145
TSeqCollection * fFiles
Definition: TROOT.h:156
TSeqCollection * GetListOfGeometries() const
Definition: TROOT.h:254
Describes an Operating System directory for the browser.
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...
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT&#39;s implicit multi-threading for all objects and methods that provide an internal paralleli...
Definition: TROOT.cxx:580
TCollection * fClasses
Definition: TROOT.h:150
A doubly linked list.
Definition: TList.h:44
Long_t Macro(const char *filename, Int_t *error=0, Bool_t padUpdate=kTRUE)
Execute a macro in the interpreter.
Definition: TROOT.cxx:2313
R__EXTERN TVirtualMutex * gGlobalMutex
Definition: TVirtualMutex.h:29
TStyle objects may be created to define special styles.
Definition: TStyle.h:27
R__EXTERN TROOT * gROOTLocal
Definition: TROOT.h:387
Bool_t fEditHistograms
Definition: TROOT.h:139
#define R__READ_LOCKGUARD(mutex)
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
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:1095
Int_t fVersionTime
Definition: TROOT.h:126
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
R__EXTERN TVirtualX * gGXBatch
Definition: TVirtualX.h:348
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:1514
static Bool_t fgMemCheck
Definition: TROOT.h:112
Bool_t IsParBranchProcessingEnabled()
Returns true if parallel branch processing is enabled.
Definition: TROOT.cxx:446
TSeqCollection * fDataSets
Definition: TROOT.h:174
Definition: Buttons.h:33
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TObject.cxx:321
TSeqCollection * fMessageHandlers
Definition: TROOT.h:168
void Browse(TBrowser *b)
Add browsable objects to TBrowser.
Definition: TROOT.cxx:1076
virtual Bool_t Init()
Initialize the OS interface.
Definition: TSystem.cxx:192
void AddClassGenerator(TClassGenerator *gen)
Add a class generator.
Definition: TROOT.cxx:1055
TString fDefCanvasName
Definition: TROOT.h:181
R__EXTERN TSystem * gSystem
Definition: TSystem.h:560
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:2686
TGlobal * GetGlobal(const char *name, Bool_t load=kFALSE) const
Return pointer to global variable by name.
Definition: TROOT.cxx:1616
Definition: Buttons.h:33
if object ctor succeeded but object should not be used
Definition: TObject.h:68
void GetNormalizedName(std::string &norm_name, std::string_view name)
Return the normalized name.
Definition: TClassEdit.cxx:832
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
auto * a
Definition: textangle.C:12
Int_t gDebug
Definition: TROOT.cxx:639
TPluginManager * fPluginManager
Definition: TROOT.h:179
TString fGitBranch
Definition: TROOT.h:130
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:610
TSeqCollection * fSecContexts
Definition: TROOT.h:171
Collection abstract base class.
Definition: TCollection.h:63
void(* VoidFuncPtr_t)()
Definition: Rtypes.h:77
static Int_t ConvertVersionCode2Int(Int_t code)
Convert version code to an integer, i.e. 331527 -> 51507.
Definition: TROOT.cxx:2885
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
unsigned int UInt_t
Definition: RtypesCore.h:42
void ReadGitInfo()
Read Git commit information and branch name from the etc/gitinfo.txt file.
Definition: TROOT.cxx:2426
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
void SetWebDisplay(const char *webdisplay)
Specify where web graphics shall be rendered.
Definition: TROOT.cxx:2817
virtual TObject * FindObject(const char *name) const
Returns address of a ROOT object if it exists.
Definition: TROOT.cxx:1309
Ssiz_t Length() const
Definition: TString.h:405
TObject * GetGeometry(const char *name) const
Return pointer to Geometry with name.
Definition: TROOT.cxx:1732
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
Definition: TDirectory.cxx:190
static void EnableStatistics(int size=-1, int ix=-1)
Enable memory usage statistics gathering.
Definition: TStorage.cxx:450
This class implements a plugin library manager.
static const TString & GetSourceDir()
Get the source directory in the installation. Static utility function.
Definition: TROOT.cxx:3099
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1106
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:2180
Objects following this interface can be passed onto the TROOT object to implement a user customized w...
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2853
static TProcessID * AddProcessID()
Static function to add a new TProcessID to the list of PIDs.
Definition: TProcessID.cxx:114
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
Definition: TROOT.cxx:1067
TFile * GetFile() const
Definition: TROOT.h:270
virtual void SaveContext()=0
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:28
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4753
A collection of TDataType designed to hold the typedef information and numerical type information...
Definition: TListOfTypes.h:30
TROOT * GetROOT()
Definition: TROOT.cxx:520
void Warning(const char *location, const char *msgfmt,...)
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:2227
void InitSystem()
Initialize operating system interface.
Definition: TROOT.cxx:1948
if object destructor must call RecursiveRemove()
Definition: TObject.h:60
#define gVirtualX
Definition: TVirtualX.h:345
TSeqCollection * fSpecials
Definition: TROOT.h:166
virtual TObjLink * FirstLink() const
Definition: TList.h:108
const Bool_t kFALSE
Definition: RtypesCore.h:88
static void RemoveClass(TClass *cl)
static: Remove a class from the list and map of classes
Definition: TClass.cxx:476
TString fGitDate
Definition: TROOT.h:131
static void SetDirLevel(Int_t level=0)
Return Indentation level for ls().
Definition: TROOT.cxx:2877
#define SafeDelete(p)
Definition: RConfig.hxx:550
TString & Remove(Ssiz_t pos)
Definition: TString.h:668
long Long_t
Definition: RtypesCore.h:50
The Canvas class.
Definition: TCanvas.h:31
const std::string & GetRootSys()
Bool_t IsExecutingMacro() const
Definition: TROOT.h:290
TSeqCollection * GetListOfColors() const
Definition: TROOT.h:242
TListOfFunctions * fGlobalFunctions
Definition: TROOT.h:154
#define d(i)
Definition: RSha256.hxx:102
Long_t ProcessLine(const char *line, Int_t *error=0)
Process interpreter command via TApplication::ProcessLine().
Definition: TROOT.cxx:2367
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
The file contains utilities which are foundational and could be used across the core component of ROO...
TSeqCollection * fCanvases
Definition: TROOT.h:159
static void BuildStyles()
Create some standard styles.
Definition: TStyle.cxx:427
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
#define ClassImp(name)
Definition: Rtypes.h:365
void EnableThreadSafety()
Enables the global mutex to make ROOT thread safe/aware.
Definition: TROOT.cxx:549
TFunction * GetGlobalFunctionWithPrototype(const char *name, const char *proto=0, Bool_t load=kFALSE)
Return pointer to global function by name.
Definition: TROOT.cxx:1703
static DestroyInterpreter_t * gDestroyInterpreter
Definition: TROOT.cxx:175
void SetReadingObject(Bool_t flag=kTRUE)
Definition: TROOT.cxx:2468
virtual Func_t DynFindSymbol(const char *module, const char *entry)
Find specific entry point in specified library.
Definition: TSystem.cxx:2037
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:892
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
Definition: TSystem.cxx:2013
TString fConfigOptions
Definition: TROOT.h:120
void InitThreads()
Load and initialize thread library.
Definition: TROOT.cxx:2029
void RecursiveRemove(TObject *obj)
Recursively remove this object from the list of Cleanups.
Definition: TROOT.cxx:2501
void Unload()
Mark &#39;all func&#39; as being unloaded.
Describe directory structure in memory.
Definition: TDirectory.h:34
static TDirectory *& CurrentDirectory()
Return the current directory for the current thread.
Definition: TDirectory.cxx:380
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
TSeqCollection * GetListOfStyles() const
Definition: TROOT.h:251
static void AddClass(TClass *cl)
static: Add a class to the list and map of classes.
Definition: TClass.cxx:450
TSeqCollection * GetListOfFiles() const
Definition: TROOT.h:247
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
Definition: TROOT.cxx:3004
Definition: Buttons.h:31
Bool_t fFromPopUp
Definition: TROOT.h:140
static RooMathCoreReg dummy
Int_t fTimer
Definition: TROOT.h:132
TCanvas * style()
Definition: style.C:1
static void CallCloseFiles()
Insure that the files, canvases and sockets are closed.
Definition: TROOT.cxx:2525
void EnableParBranchProcessing()
Globally enables the parallel branch processing, which is a case of implicit multi-threading (IMT) in...
Definition: TROOT.cxx:417
Bool_t fBatch
Definition: TROOT.h:135
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Long_t ProcessLineFast(const char *line, Int_t *error=0)
Process interpreter command directly via CINT interpreter.
Definition: TROOT.cxx:2404
void CloseFiles()
Close any files and sockets that gROOT knows about.
Definition: TROOT.cxx:1169
virtual ~TROOT()
Clean up and free resources used by ROOT (files, network sockets, shared memory segments, etc.).
Definition: TROOT.cxx:904
#define R__LOCKGUARD(mutex)
The color creation and management class.
Definition: TColor.h:19
TSeqCollection * fStyles
Definition: TROOT.h:160
virtual void Add(TObject *obj)=0
virtual void CleanCompiledMacros()
Remove the shared libs produced by the CompileMacro() function.
Definition: TSystem.cxx:4319
Bool_t fReadingObject
Definition: TROOT.h:142
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:2906
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:399
TCollection * fClassGenerators
Definition: TROOT.h:170
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:1898
static TClass * LoadClass(const char *requestedname, Bool_t silent)
Helper function used by TClass::GetClass().
Definition: TClass.cxx:5544
virtual void Reset()=0
Bool_t IsNull() const
Definition: TString.h:402
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition: TClass.cxx:3323
virtual void Delete(Option_t *option="")
Delete all TDataMember object files.
static Int_t GetDirLevel()
return directory level
Definition: TROOT.cxx:2757
Int_t fBuiltTime
Definition: TROOT.h:128
Mother of all ROOT objects.
Definition: TObject.h:37
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:28
Bool_t fIsWebDisplay
Definition: TROOT.h:137
This ABC is a factory for GUI components.
Definition: TGuiFactory.h:42
TFunction * GetGlobalFunction(const char *name, const char *params=0, Bool_t load=kFALSE)
Return pointer to global function by name.
Definition: TROOT.cxx:1670
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
Definition: TROOT.h:197
static Int_t ConvertVersionInt2Code(Int_t v)
Convert version as an integer to version code as used in RVersion.h.
Definition: TROOT.cxx:2893
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
Definition: TROOT.cxx:2845
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:1850
static const TString & GetDataDir()
Get the data directory in the installation. Static utility function.
Definition: TROOT.cxx:3014
Int_t fBuiltDate
Definition: TROOT.h:127
void Unload()
Mark &#39;all func&#39; as being unloaded.
TFunctionTemplate * GetFunctionTemplate(const char *name)
Definition: TROOT.cxx:1603
TColor * GetColor(Int_t color) const
Return address of color with index color.
Definition: TROOT.cxx:1532
void Load()
Load all the functions known to the interpreter for the scope &#39;fClass&#39; into this collection.
Bool_t fIsWebDisplayBatch
Definition: TROOT.h:138
TCollection * fFunctions
Definition: TROOT.h:161
const char * FindObjectClassName(const char *name) const
Returns class name of a ROOT object including CINT globals.
Definition: TROOT.cxx:1449
static void SetMacroPath(const char *newpath)
Set or extend the macro search path.
Definition: TROOT.cxx:2791
TROOT *(* GetROOTFun_t)()
Definition: TROOT.cxx:394
static Int_t IDATQQ(const char *date)
Return built date as integer, i.e. "Apr 28 2000" -> 20000428.
Definition: TROOT.cxx:199
virtual void Add(TObject *obj)
Definition: TList.h:87
auto * l
Definition: textangle.C:4
TListOfDataMembers * fGlobals
Definition: TROOT.h:153
static const TString & GetLibDir()
Get the library directory in the installation. Static utility function.
Definition: TROOT.cxx:2973
R__EXTERN const char * gRootDir
Definition: TSystem.h:243
TSeqCollection * fClosedObjects
Definition: TROOT.h:155
TClass * FindSTLClass(const char *name, Bool_t load, Bool_t silent=kFALSE) const
return a TClass object corresponding to &#39;name&#39; assuming it is an STL container.
Definition: TROOT.cxx:1480
#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:189
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Int_t fLineIsProcessing
Definition: TROOT.h:108
TSeqCollection * fTasks
Definition: TROOT.h:162
static void CleanUpROOTAtExit()
Clean up at program termination before global objects go out of scope.
Definition: TROOT.cxx:230
TSeqCollection * fColors
Definition: TROOT.h:163
Int_t GetNumber() const
Definition: TColor.h:55
TCollection * fTypes
Definition: TROOT.h:151
#define gPad
Definition: TVirtualPad.h:286
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
const char * proto
Definition: civetweb.c:16604
object has not been deleted
Definition: TObject.h:78
#define c(i)
Definition: RSha256.hxx:101
TSeqCollection * fBrowsers
Definition: TROOT.h:165
static GetROOTFun_t gGetROOT
Definition: TROOT.cxx:396
static void ShutDown()
Shut down ROOT.
Definition: TROOT.cxx:3088
static void MakeFunctor(const char *name, const char *type, GlobFunc &func)
Definition: TGlobal.h:73
#define gDirectory
Definition: TDirectory.h:223
static void InitializeColors()
Initialize colors used by the TCanvas based graphics (via TColor objects).
Definition: TColor.cxx:1083
virtual TObject * FindObjectAnyFile(const char *name) const
Scan the memory lists of all files for an object with name.
Definition: TROOT.cxx:1432
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition: TROOT.cxx:2952
TList * fBrowsables
Definition: TROOT.h:178
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
TSeqCollection * fSockets
Definition: TROOT.h:158
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:908
TObject * FindSpecialObject(const char *name, void *&where)
Returns address and folder of a ROOT object if it exists.
Definition: TROOT.cxx:1363
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:556
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
Bool_t fInterrupt
Definition: TROOT.h:144
Abstract base class defining a generic interface to the underlying Operating System.
Definition: TSystem.h:268
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
void Idle(UInt_t idleTimeInSec, const char *command=0)
Execute command when system has been idle for idleTimeInSec seconds.
Definition: TROOT.cxx:1862
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
TSeqCollection * GetListOfBrowsers() const
Definition: TROOT.h:255
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1054
#define sym(otri1, otri2)
Definition: triangle.c:932
const std::string & GetEtcDir()
static TClass * R__GetClassIfKnown(const char *className)
Check whether className is a known class, and only autoload if we can.
Definition: TROOT.cxx:1877
char name[80]
Definition: TGX11.cxx:109
TString fConfigFeatures
Definition: TROOT.h:121
TProcessUUID * fUUIDs
Definition: TROOT.h:176
void DisableParBranchProcessing()
Globally disables the IMT use case of parallel branch processing, deactivating the corresponding lock...
Definition: TROOT.cxx:433
static void PrintStatistics()
Print memory usage statistics.
Definition: TStorage.cxx:406
const TObject * fPrimitive
Definition: TROOT.h:148
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
TVirtualPad * fSelectPad
Definition: TROOT.h:149
virtual TObject * First() const =0
virtual TObject * Last() const =0
TDictionary * Get(DeclId_t id)
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
const char * Data() const
Definition: TString.h:364
TROOT()
Default ctor.
Definition: TROOT.cxx:647