| The Gaudi Framework v32r1 (f65d50dc)

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__ (self, fileName)
def | save (self, *args)
def | close (self)

## Public Attributes
| file
| aida2root
| aidaTypes

## Private Member Functions
def | __convertibleType (self, histo)

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

## Constructor & Destructor Documentation

## ◆ __init__()

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

Definition at line 991 of file HistoUtils.py.

991 def __init__(self, fileName):
992 self.file = ROOT.TFile(fileName, "RECREATE")
993 from GaudiPython import gbl
994 self.aida2root = gbl.Gaudi.Utils.Aida2ROOT.aida2root
995 self.aidaTypes = [
996 gbl.AIDA.IHistogram1D, gbl.AIDA.IHistogram2D,
997 gbl.AIDA.IHistogram3D, gbl.AIDA.IProfile1D, gbl.AIDA.IProfile2D,
998 gbl.AIDA.IHistogram
999 ]
1000

## Member Function Documentation

## ◆ __convertibleType()

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

Definition at line 1001 of file HistoUtils.py.

1001 def __convertibleType(self, histo):
1002 histoType = type(histo)
1003 for t in self.aidaTypes:
1004 if histoType == t:
1005 return True
1006 return False
1007
gaudirun.type
type
Definition: gaudirun.py:142

## ◆ close()

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

Definition at line 1024 of file HistoUtils.py.

1024 def close(self):
1025 self.file.Write()
1026 self.file.Close()
1027
1028
1029 # =============================================================================

## ◆ save()

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

1008 def save(self, *args):
1009 """
1010 This function stores histograms on the file for future saving.
1011 It takes an arbitrary number of AIDA or ROOT histograms or
1012 a list of them.
1013 """
1014 if args:
1015 if type(args[0]) == list:
1016 histoList = args[0]
1017 else:
1018 histoList = args
1019 for h in histoList:
1020 if self.__convertibleType(h):
1021 h = self.aida2root(h)
1022 h.Write()
1023
gaudirun.type
type
Definition: gaudirun.py:142

## Member Data Documentation

## ◆ __author__

string GaudiPython.HistoUtils.HistoFile.__author__ = "Juan Palacios juan.palacios@nikhef.nl"
| static private

Definition at line 989 of file HistoUtils.py.

## ◆ aida2root

GaudiPython.HistoUtils.HistoFile.aida2root

Definition at line 994 of file HistoUtils.py.

## ◆ aidaTypes

GaudiPython.HistoUtils.HistoFile.aidaTypes

Definition at line 995 of file HistoUtils.py.

## ◆ file

GaudiPython.HistoUtils.HistoFile.file

Definition at line 992 of file HistoUtils.py.

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

- GaudiPython/python/GaudiPython/HistoUtils.py