File indexing completed on 2024-04-06 12:23:23
0001 #include "PhysicsTools/FWLite/interface/TFileService.h"
0002 #include "TFile.h"
0003 #include "TROOT.h"
0004
0005 namespace fwlite {
0006
0007 TFileService::TFileService(const std::string& fileName)
0008 : TFileDirectory("", "", TFile::Open(fileName.c_str(), "RECREATE"), ""),
0009 file_(TFileDirectory::file_),
0010 fileName_(fileName) {}
0011
0012 TFileService::TFileService(TFile* aFile)
0013 : TFileDirectory("", "", aFile, ""), file_(TFileDirectory::file_), fileName_(aFile->GetName()) {}
0014
0015 TFileService::~TFileService() {
0016 file_->Write();
0017 file_->Close();
0018 delete file_;
0019 }
0020
0021 }