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