| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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__
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"

## 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
832 def __init__(self, fileName) :
833 self.file = ROOT.TFile(fileName, "RECREATE")
834 from GaudiPython import gbl
835 self.aida2root = gbl.Gaudi.Utils.Aida2ROOT.aida2root
836 self.aidaTypes = [ gbl.AIDA.IHistogram1D,
837 gbl.AIDA.IHistogram2D,
838 gbl.AIDA.IHistogram3D,
839 gbl.AIDA.IProfile1D,
840 gbl.AIDA.IProfile2D,
841 gbl.AIDA.IHistogram ]

## Member Function Documentation

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

Definition at line 842 of file HistoUtils.py.

842
843 def __convertibleType(self, histo) :
844 histoType = type(histo)
845 for t in self.aidaTypes :
846 if histoType == t : return True
847 return False

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

Definition at line 863 of file HistoUtils.py.

863
864 def close(self) :
865 self.file.Write()
866 self.file.Close()
867
# =============================================================================

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
849 def save(self, *args) :
850 """
851 This function stores histograms on the file for future saving.
852 It takes an arbitrary number of AIDA or ROOT histograms or
853 a list of them.
854 """
855 if args :
856 if type(args[0])==list :
857 histoList = args[0]
858 else :
859 histoList = args
860 for h in histoList :
861 if self.__convertibleType(h) : h = self.aida2root(h)
862 h.Write()

## 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:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiPython/python/GaudiPython/HistoUtils.py