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