CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
tfile.TFileService Class Reference
Inheritance diagram for tfile.TFileService:

Public Member Functions

def __init__ (self, cfg, comp, outdir)
 
def stop (self)
 

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

◆ __init__()

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  def __init__(self, cfg, comp, outdir):
19  """
20  cfg must contain:
21  - fname: file name
22  - option: TFile options, e.g. recreate
23 
24  outdir is the output directory for the TFile
25 
26  comp is a dummy parameter here.
27  It is needed because the looper creates services and analyzers
28  in the same way, providing the configuration (cfg),
29  the component currently processed (comp),
30  and the output directory.
31 
32  Other implementations of the TFileService could
33  make use of the component information, eg. the component name.
34  """
35  fname = '/'.join([outdir, cfg.fname])
36  self.file = TFile(fname, cfg.option)
37 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Member Function Documentation

◆ stop()

def tfile.TFileService.stop (   self)

Member Data Documentation

◆ file

tfile.TFileService.file