Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

GaudiPython::HistoUtils::HistoFile Class Reference

List of all members.


Detailed Description

Class to write histograms to a ROOT file.
hFile = HistoFile("myFile.root")
myHisto = ...
hFile.save(myHisto)
myHisto0 = ...
myHisto1 = ...
myHisto2 = ...
hFile.save(myHisto0, myHisto1, myHisto2)
histoList = [h0, h1, h2, h3]
hFile.save(histoList)
...
hWriter.close()

Definition at line 749 of file HistoUtils.py.


Public Member Functions

def __init__
def save
def close

Public Attributes

 file
 aida2root
 aidaTypes

Private Member Functions

def __convertibleType

Static Private Attributes

string __author__ = "Juan Palacios juan.palacios@nikhef.nl"

Member Function Documentation

def GaudiPython::HistoUtils::HistoFile::__init__ (   self,
  fileName 
)

Definition at line 766 of file HistoUtils.py.

00766                                  :
00767         self.file = TFile(fileName, "RECREATE")
00768         self.aida2root = gbl.Gaudi.Utils.Aida2ROOT.aida2root
00769         self.aidaTypes = [gbl.AIDA.IHistogram1D,
00770                           gbl.AIDA.IHistogram2D,
00771                           gbl.AIDA.IHistogram3D,
00772                           gbl.AIDA.IProfile1D,
00773                           gbl.AIDA.IProfile2D,
00774                           gbl.AIDA.IHistogram    ]
00775 
    def __convertibleType(self, histo) :

def GaudiPython::HistoUtils::HistoFile::__convertibleType (   self,
  histo 
) [private]

Definition at line 776 of file HistoUtils.py.

00776                                        :
00777         histoType = type(histo)
00778         for t in self.aidaTypes :
00779             if histoType == t : return True
00780         return False
00781     
    def save(self, *args) :

def GaudiPython::HistoUtils::HistoFile::save (   self,
  args 
)

This function stores histograms on the file for future saving.
It takes an arbitrary number of AIDA or ROOT histograms or
a list of them.

Definition at line 782 of file HistoUtils.py.

00782                           :
00783         """
00784         This function stores histograms on the file for future saving.
00785         It takes an arbitrary number of AIDA or ROOT histograms or
00786         a list of them.
00787         """
00788         if args :
00789             if type(args[0])==list :
00790                 histoList = args[0]
00791             else :
00792                 histoList = args
00793             for h in histoList :
00794                 if self.__convertibleType(h) : h = self.aida2root(h)
00795                 h.Write()
00796             
    def close(self) :

def GaudiPython::HistoUtils::HistoFile::close (   self  ) 

Definition at line 797 of file HistoUtils.py.

00797                     :
00798         self.file.Write()
00799         self.file.Close()
00800 
00801 # =============================================================================
if '__main__' == __name__ :


Member Data Documentation

string GaudiPython::HistoUtils::HistoFile::__author__ = "Juan Palacios juan.palacios@nikhef.nl" [static, private]

Definition at line 764 of file HistoUtils.py.

Definition at line 767 of file HistoUtils.py.

Definition at line 768 of file HistoUtils.py.

Definition at line 769 of file HistoUtils.py.


The documentation for this class was generated from the following file:

Generated at Mon Sep 7 18:26:43 2009 for Gaudi Framework, version v21r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004