| The Gaudi Framework v29r0 (ff2e7097)

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

## Constructor & Destructor Documentation

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

Definition at line 960 of file HistoUtils.py.

960 def __init__(self, fileName):
961 self.file = ROOT.TFile(fileName, "RECREATE")
962 from GaudiPython import gbl
963 self.aida2root = gbl.Gaudi.Utils.Aida2ROOT.aida2root
964 self.aidaTypes = [gbl.AIDA.IHistogram1D,
965 gbl.AIDA.IHistogram2D,
966 gbl.AIDA.IHistogram3D,
967 gbl.AIDA.IProfile1D,
968 gbl.AIDA.IProfile2D,
969 gbl.AIDA.IHistogram]
970
GaudiPython.HistoUtils.HistoFile.file
file
Definition: HistoUtils.py:961
GaudiPython.HistoUtils.HistoFile.__init__
def __init__(self, fileName)
Definition: HistoUtils.py:960
GaudiPython.HistoUtils.HistoFile.aida2root
aida2root
Definition: HistoUtils.py:963
GaudiPython.HistoUtils.HistoFile.aidaTypes
aidaTypes
Definition: HistoUtils.py:964

## Member Function Documentation

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

Definition at line 971 of file HistoUtils.py.

971 def __convertibleType(self, histo):
972 histoType = type(histo)
973 for t in self.aidaTypes:
974 if histoType == t:
975 return True
976 return False
977
gaudirun.type
type
Definition: gaudirun.py:133
GaudiPython.HistoUtils.HistoFile.aidaTypes
aidaTypes
Definition: HistoUtils.py:964
GaudiPython.HistoUtils.HistoFile.__convertibleType
def __convertibleType(self, histo)
Definition: HistoUtils.py:971

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

Definition at line 994 of file HistoUtils.py.

994 def close(self):
995 self.file.Write()
996 self.file.Close()
997
998
999 # =============================================================================
GaudiPython.HistoUtils.HistoFile.close
def close(self)
Definition: HistoUtils.py:994

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

978 def save(self, *args):
979 """
980 This function stores histograms on the file for future saving.
981 It takes an arbitrary number of AIDA or ROOT histograms or
982 a list of them.
983 """
984 if args:
985 if type(args[0]) == list:
986 histoList = args[0]
987 else:
988 histoList = args
989 for h in histoList:
990 if self.__convertibleType(h):
991 h = self.aida2root(h)
992 h.Write()
993
gaudirun.type
type
Definition: gaudirun.py:133
GaudiPython.HistoUtils.HistoFile.aida2root
aida2root
Definition: HistoUtils.py:963
GaudiPython.HistoUtils.HistoFile.save
def save(self, args)
Definition: HistoUtils.py:978
GaudiPython.HistoUtils.HistoFile.__convertibleType
def __convertibleType(self, histo)
Definition: HistoUtils.py:971

## Member Data Documentation

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

Definition at line 958 of file HistoUtils.py.

GaudiPython.HistoUtils.HistoFile.aida2root

Definition at line 963 of file HistoUtils.py.

GaudiPython.HistoUtils.HistoFile.aidaTypes

Definition at line 964 of file HistoUtils.py.

GaudiPython.HistoUtils.HistoFile.file

Definition at line 961 of file HistoUtils.py.

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

- GaudiPython/python/GaudiPython/HistoUtils.py