| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# 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::__init__ | ( |  | self,
|  |  | fileName |
| ) |  |  |

Definition at line 831 of file HistoUtils.py.

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

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

Definition at line 841 of file HistoUtils.py.

    00841                                        :
    00842         histoType = type(histo)
    00843         for t in self.aidaTypes :
    00844             if histoType == t : return True
    00845         return False
    00846
        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 847 of file HistoUtils.py.

    00847                           :
    00848         """
    00849         This function stores histograms on the file for future saving.
    00850         It takes an arbitrary number of AIDA or ROOT histograms or
    00851         a list of them.
    00852         """
    00853         if args :
    00854             if type(args[0])==list :
    00855                 histoList = args[0]
    00856             else :
    00857                 histoList = args
    00858             for h in histoList :
    00859                 if self.__convertibleType(h) : h = self.aida2root(h)
    00860                 h.Write()
    00861
        def close(self) :

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

Definition at line 862 of file HistoUtils.py.

    00862                     :
    00863         self.file.Write()
    00864         self.file.Close()
    00865
    00866 # =============================================================================
    if '__main__' == __name__ :

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

Definition at line 832 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.

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

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