| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes | List of all members
GaudiPython.HistoUtils.HistoFile Class Reference
Collaboration diagram for GaudiPython.HistoUtils.HistoFile:
[legend]

## Public Member Functions
def | __init__ (self, fileName)
def | save (self, args)
def | close (self)

## Public Attributes
| file
| aida2root
| aidaTypes

## Private Member Functions
def | __convertibleType (self, histo)

## Static Private Attributes
string | __author__ = "Juan Palacios juan.palacios@nikhef.nl"

## 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 814 of file HistoUtils.py.

## Constructor & Destructor Documentation

def GaudiPython.HistoUtils.HistoFile.__init__ | ( |  | self,
|  |  | fileName
| ) |  |

Definition at line 831 of file HistoUtils.py.

831 def __init__(self, fileName) :
832 self.file = ROOT.TFile(fileName, "RECREATE")
833 from GaudiPython import gbl
834 self.aida2root = gbl.Gaudi.Utils.Aida2ROOT.aida2root
835 self.aidaTypes = [ gbl.AIDA.IHistogram1D,
836 gbl.AIDA.IHistogram2D,
837 gbl.AIDA.IHistogram3D,
838 gbl.AIDA.IProfile1D,
839 gbl.AIDA.IProfile2D,
840 gbl.AIDA.IHistogram ]
841
GaudiPython.HistoUtils.HistoFile.file
file
Definition: HistoUtils.py:832
GaudiPython.HistoUtils.HistoFile.__init__
def __init__(self, fileName)
Definition: HistoUtils.py:831
GaudiPython.HistoUtils.HistoFile.aida2root
aida2root
Definition: HistoUtils.py:834
GaudiPython.HistoUtils.HistoFile.aidaTypes
aidaTypes
Definition: HistoUtils.py:835

## Member Function Documentation

def GaudiPython.HistoUtils.HistoFile.__convertibleType | ( |  | self,
|  |  | histo
| ) |  |
| private

Definition at line 842 of file HistoUtils.py.

842 def __convertibleType(self, histo) :
843 histoType = type(histo)
844 for t in self.aidaTypes :
845 if histoType == t : return True
846 return False
847
gaudirun.type
string type
Definition: gaudirun.py:151
GaudiPython.HistoUtils.HistoFile.aidaTypes
aidaTypes
Definition: HistoUtils.py:835
GaudiPython.HistoUtils.HistoFile.__convertibleType
def __convertibleType(self, histo)
Definition: HistoUtils.py:842

def GaudiPython.HistoUtils.HistoFile.close | ( |  | self | ) |

Definition at line 863 of file HistoUtils.py.

863 def close(self) :
864 self.file.Write()
865 self.file.Close()
866
867 # =============================================================================
GaudiPython.HistoUtils.HistoFile.close
def close(self)
Definition: HistoUtils.py:863

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 848 of file HistoUtils.py.

848 def save(self, *args) :
849 """
850 This function stores histograms on the file for future saving.
851 It takes an arbitrary number of AIDA or ROOT histograms or
852 a list of them.
853 """
854 if args :
855 if type(args[0])==list :
856 histoList = args[0]
857 else :
858 histoList = args
859 for h in histoList :
860 if self.__convertibleType(h) : h = self.aida2root(h)
861 h.Write()
862
gaudirun.type
string type
Definition: gaudirun.py:151
GaudiPython.HistoUtils.HistoFile.aida2root
aida2root
Definition: HistoUtils.py:834
GaudiPython.HistoUtils.HistoFile.save
def save(self, args)
Definition: HistoUtils.py:848
GaudiPython.HistoUtils.HistoFile.__convertibleType
def __convertibleType(self, histo)
Definition: HistoUtils.py:842

## Member Data Documentation

string GaudiPython.HistoUtils.HistoFile.__author__ = "Juan Palacios juan.palacios@nikhef.nl"
| static private

Definition at line 829 of file HistoUtils.py.

GaudiPython.HistoUtils.HistoFile.aida2root

Definition at line 834 of file HistoUtils.py.

GaudiPython.HistoUtils.HistoFile.aidaTypes

Definition at line 835 of file HistoUtils.py.

GaudiPython.HistoUtils.HistoFile.file

Definition at line 832 of file HistoUtils.py.

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

- GaudiPython/python/GaudiPython/HistoUtils.py