CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
tfile.TFileService Class Reference
Inheritance diagram for tfile.TFileService:

Public Member Functions

def __init__
 
def stop
 

Public Attributes

 file
 

Detailed Description

TFile service.
The file attribute is a TFile that can be used in several analyzers.
The file is closed when the service stops.

Example configuration:

output_rootfile = cfg.Service(
  TFileService,
  'myhists',
  fname='histograms.root',
  option='recreate'
)

Definition at line 4 of file tfile.py.

Constructor & Destructor Documentation

def tfile.TFileService.__init__ (   self,
  cfg,
  comp,
  outdir 
)
cfg must contain:
- fname: file name 
- option: TFile options, e.g. recreate

outdir is the output directory for the TFile

comp is a dummy parameter here.  
It is needed because the looper creates services and analyzers 
in the same way, providing the configuration (cfg), 
the component currently processed (comp), 
and the output directory. 

Other implementations of the TFileService could 
make use of the component information, eg. the component name. 

Definition at line 18 of file tfile.py.

References join().

18 
19  def __init__(self, cfg, comp, outdir):
20  """
21  cfg must contain:
22  - fname: file name
23  - option: TFile options, e.g. recreate
24 
25  outdir is the output directory for the TFile
26 
27  comp is a dummy parameter here.
28  It is needed because the looper creates services and analyzers
29  in the same way, providing the configuration (cfg),
30  the component currently processed (comp),
31  and the output directory.
32 
33  Other implementations of the TFileService could
34  make use of the component information, eg. the component name.
35  """
36  fname = '/'.join([outdir, cfg.fname])
37  self.file = TFile(fname, cfg.option)
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Member Function Documentation

def tfile.TFileService.stop (   self)

Definition at line 38 of file tfile.py.

38 
39  def stop(self):
40  self.file.Write()
41  self.file.Close()
42 

Member Data Documentation

tfile.TFileService.file

Definition at line 36 of file tfile.py.