// RooDirItem is a utility base class for RooFit objects that are to be attached
// to ROOT directories. Concrete classes inherit the appendToDir and removeToDir
// methods that can be used to safely attach and detach one self from a TDirectory
// END_HTML
#include "RooFit.h"
#include "Riostream.h"
#include "Riostream.h"
#include "TROOT.h"
#include "TList.h"
#include "TDirectoryFile.h"
#include "TString.h"
#include "RooDirItem.h"
ClassImp(RooDirItem) ;
RooDirItem::RooDirItem() : _dir(0)
{
}
RooDirItem::RooDirItem(const RooDirItem& ) : _dir(0)
{
}
RooDirItem::~RooDirItem()
{
}
void RooDirItem::removeFromDir(TObject* obj)
{
if (_dir) {
if (!_dir->TestBit(TDirectoryFile::kCloseDirectory))
_dir->GetList()->Remove(obj) ;
}
}
void RooDirItem::appendToDir(TObject* obj, Bool_t forceMemoryResident)
{
if (forceMemoryResident) {
TString pwd(gDirectory->GetPath()) ;
TString memDir(gROOT->GetName()) ;
memDir.Append(":/") ;
gDirectory->cd(memDir) ;
_dir = gDirectory ;
gDirectory->Append(obj) ;
gDirectory->cd(pwd) ;
} else {
_dir = gDirectory ;
gDirectory->Append(obj) ;
}
}
Last change: Wed Jun 25 08:32:35 2008
Last generated: 2008-06-25 08:32
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.