ROOT
master
Reference Guide
RooDirItem.cxx
Go to the documentation of this file.
1
/*****************************************************************************
2
* Project: RooFit *
3
* Package: RooFitCore *
4
* @(#)root/roofitcore:$Id$
5
* Authors: *
6
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8
* *
9
* Copyright (c) 2000-2005, Regents of the University of California *
10
* and Stanford University. All rights reserved. *
11
* *
12
* Redistribution and use in source and binary forms, *
13
* with or without modification, are permitted according to the terms *
14
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15
*****************************************************************************/
16
17
/**
18
\file RooDirItem.cxx
19
\class RooDirItem
20
\ingroup Roofitcore
21
22
RooDirItem is a utility base class for RooFit objects that are to be attached
23
to ROOT directories. Concrete classes inherit the appendToDir and removeToDir
24
methods that can be used to safely attach and detach one self from a TDirectory
25
**/
26
27
#include "
RooFit.h
"
28
29
#include <iostream>
30
#include "
TList.h
"
31
#include "
TDirectoryFile.h
"
32
#include "
TString.h
"
33
#include "
RooDirItem.h
"
34
35
using namespace
std;
36
37
ClassImp
(
RooDirItem
);
38
39
40
////////////////////////////////////////////////////////////////////////////////
41
/// Remove object from directory it was added to
42
43
void
RooDirItem::removeFromDir
(
TObject
* obj)
44
{
45
if
(_dir) {
46
_dir->GetList()->Remove(obj) ;
47
}
48
}
49
50
51
52
////////////////////////////////////////////////////////////////////////////////
53
/// Append object to directory. If forceMemoryResident is
54
/// true, nothing happens.
55
void
RooDirItem::appendToDir
(
TObject
* obj,
Bool_t
forceMemoryResident)
56
{
57
if
(forceMemoryResident) {
58
// If we are not going into a file, appending to a directory
59
// doesn't make sense. It only creates global state and congestion.
60
return
;
61
}
else
{
62
// Append self to present gDirectory
63
_dir =
gDirectory
;
64
gDirectory
->Append(obj) ;
65
}
66
}
67
RooDirItem::removeFromDir
void removeFromDir(TObject *obj)
Remove object from directory it was added to.
Definition:
RooDirItem.cxx:43
RooFit.h
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:364
RooDirItem
RooDirItem is a utility base class for RooFit objects that are to be attached to ROOT directories.
Definition:
RooDirItem.h:22
TList.h
TString.h
bool
gDirectory
#define gDirectory
Definition:
TDirectory.h:290
RooDirItem.h
TDirectoryFile.h
RooDirItem::appendToDir
void appendToDir(TObject *obj, Bool_t forceMemoryResident=kFALSE)
Append object to directory.
Definition:
RooDirItem.cxx:55
TObject
Mother of all ROOT objects.
Definition:
TObject.h:37
roofit
roofitcore
src
RooDirItem.cxx
ROOT master - Reference Guide Generated on Fri Jan 22 2021 11:58:50 (GVA Time) using Doxygen 1.9.0