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