| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes

# GaudiPython::HistoUtils::HistoFile Class Reference

Collaboration diagram for GaudiPython::HistoUtils::HistoFile:
[legend]

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.

## Constructor & Destructor Documentation

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

Definition at line 831 of file HistoUtils.py.

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

## Member Function Documentation

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

Definition at line 842 of file HistoUtils.py.

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

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

Definition at line 863 of file HistoUtils.py.

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

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.

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

GaudiPython::HistoUtils::HistoFile::aidaTypes

Definition at line 831 of file HistoUtils.py.

GaudiPython::HistoUtils::HistoFile::file

Definition at line 831 of file HistoUtils.py.

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

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

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