| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 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 790 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 807 of file HistoUtils.py.

    00807                                  :
    00808         self.file = TFile(fileName, "RECREATE")
    00809         self.aida2root = gbl.Gaudi.Utils.Aida2ROOT.aida2root
    00810         self.aidaTypes = [gbl.AIDA.IHistogram1D,
    00811                           gbl.AIDA.IHistogram2D,
    00812                           gbl.AIDA.IHistogram3D,
    00813                           gbl.AIDA.IProfile1D,
    00814                           gbl.AIDA.IProfile2D,
    00815                           gbl.AIDA.IHistogram    ]
    00816
        def __convertibleType(self, histo) :

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

Definition at line 817 of file HistoUtils.py.

    00817                                        :
    00818         histoType = type(histo)
    00819         for t in self.aidaTypes :
    00820             if histoType == t : return True
    00821         return False
    00822
        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 823 of file HistoUtils.py.

    00823                           :
    00824         """
    00825         This function stores histograms on the file for future saving.
    00826         It takes an arbitrary number of AIDA or ROOT histograms or
    00827         a list of them.
    00828         """
    00829         if args :
    00830             if type(args[0])==list :
    00831                 histoList = args[0]
    00832             else :
    00833                 histoList = args
    00834             for h in histoList :
    00835                 if self.__convertibleType(h) : h = self.aida2root(h)
    00836                 h.Write()
    00837
        def close(self) :

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

Definition at line 838 of file HistoUtils.py.

    00838                     :
    00839         self.file.Write()
    00840         self.file.Close()
    00841
    00842 # =============================================================================
    if '__main__' == __name__ :

## Member Data Documentation

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

Definition at line 805 of file HistoUtils.py.

GaudiPython::HistoUtils::HistoFile::file

Definition at line 808 of file HistoUtils.py.

GaudiPython::HistoUtils::HistoFile::aida2root

Definition at line 809 of file HistoUtils.py.

GaudiPython::HistoUtils::HistoFile::aidaTypes

Definition at line 810 of file HistoUtils.py.

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

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