CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
fwlite::TFileService Class Reference

#include <TFileService.h>

Inheritance diagram for fwlite::TFileService:
TFileDirectory

Public Member Functions

TFile & file () const
 return opened TFile More...
 
 TFileService (const std::string &fileName)
 constructor More...
 
 TFileService (TFile *aFile)
 constructor with external TFile More...
 
 ~TFileService () override
 destructor More...
 
- Public Member Functions inherited from TFileDirectory
bool cd () const
 
std::string fullPath () const
 return the full path of the stored histograms More...
 
TDirectory * getBareDirectory (const std::string &subdir="") const
 
template<typename T >
TgetObject (const std::string &objname, const std::string &subdir="")
 
template<typename T , typename... Args>
Tmake (const Args &...args) const
 make new ROOT object More...
 
TFileDirectory mkdir (const std::string &dir, const std::string &descr="")
 create a new subdirectory More...
 
 TFileDirectory ()
 
virtual ~TFileDirectory ()
 descructor More...
 

Private Attributes

TFile * file_
 pointer to opened TFile More...
 
std::string fileName_
 

Detailed Description

Definition at line 12 of file TFileService.h.

Constructor & Destructor Documentation

◆ TFileService() [1/2]

TFileService::TFileService ( const std::string &  fileName)

constructor

Definition at line 7 of file TFileService.cc.

8  : TFileDirectory("", "", TFile::Open(fileName.c_str(), "RECREATE"), ""),
TFile * file_
pointer to opened TFile
Definition: TFileService.h:28
std::string fileName_
Definition: TFileService.h:29

◆ TFileService() [2/2]

TFileService::TFileService ( TFile *  aFile)

constructor with external TFile

Definition at line 12 of file TFileService.cc.

13  : TFileDirectory("", "", aFile, ""), file_(TFileDirectory::file_), fileName_(aFile->GetName()) {}
TFile * file_
pointer to opened TFile
Definition: TFileService.h:28
std::string fileName_
Definition: TFileService.h:29

◆ ~TFileService()

TFileService::~TFileService ( )
override

destructor

Definition at line 15 of file TFileService.cc.

References file_.

15  {
16  file_->Write();
17  file_->Close();
18  delete file_;
19  }
TFile * file_
pointer to opened TFile
Definition: TFileService.h:28

Member Function Documentation

◆ file()

TFile& fwlite::TFileService::file ( ) const
inline

return opened TFile

Definition at line 24 of file TFileService.h.

References file_.

24 { return *file_; }
TFile * file_
pointer to opened TFile
Definition: TFileService.h:28

Member Data Documentation

◆ file_

TFile* fwlite::TFileService::file_
private

pointer to opened TFile

Definition at line 28 of file TFileService.h.

Referenced by file(), and ~TFileService().

◆ fileName_

std::string fwlite::TFileService::fileName_
private

Definition at line 29 of file TFileService.h.