| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# GaudiPython::HistoUtils::HistoFile Class Reference

List of all members.

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

## Member Function Documentation

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

Definition at line 841 of file HistoUtils.py.

    00842                                        :
    00843         histoType = type(histo)
    00844         for t in self.aidaTypes :
    00845             if histoType == t : return True
    00846         return False

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

Definition at line 831 of file HistoUtils.py.

    00832                                  :
    00833         self.file = TFile(fileName, "RECREATE")
    00834         self.aida2root = gbl.Gaudi.Utils.Aida2ROOT.aida2root
    00835         self.aidaTypes = [ gbl.AIDA.IHistogram1D,
    00836                            gbl.AIDA.IHistogram2D,
    00837                            gbl.AIDA.IHistogram3D,
    00838                            gbl.AIDA.IProfile1D,
    00839                            gbl.AIDA.IProfile2D,
    00840                            gbl.AIDA.IHistogram    ]

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

Definition at line 862 of file HistoUtils.py.

    00863                     :
    00864         self.file.Write()
    00865         self.file.Close()
    00866
    # =============================================================================

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

    00848                           :
    00849         """
    00850         This function stores histograms on the file for future saving.
    00851         It takes an arbitrary number of AIDA or ROOT histograms or
    00852         a list of them.
    00853         """
    00854         if args :
    00855             if type(args[0])==list :
    00856                 histoList = args[0]
    00857             else :
    00858                 histoList = args
    00859             for h in histoList :
    00860                 if self.__convertibleType(h) : h = self.aida2root(h)
    00861                 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 833 of file HistoUtils.py.

GaudiPython::HistoUtils::HistoFile::aidaTypes

Definition at line 834 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_v22r0/GaudiPython/python/GaudiPython/HistoUtils.py

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines