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