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