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