![]() |
The Gaudi Framework
v28r2p1 (f1a77ff4)
|
Classes | |
class | HistoFile |
Functions | |
def | _getAppMgr (kwargs) |
Helper private auxiliary function to get Application Manager. More... | |
def | _getHistoSvc (kwargs) |
Helper private auxiliary function to get iHistogramSvs. More... | |
def | _getEvtSvc (kwargs) |
Helper private auxiliary function to get iDataSvs. More... | |
def | book (args, kwargs) |
The trivial function to book the various 1D,2D&3D-histograms. More... | |
def | bookProf (args, kwargs) |
The trivial function to book 1D&2D profile histograms: More... | |
def | getAsAIDA (path, kwargs) |
The most trivial function to retrieve the histogram from Histogram Transient Store. More... | |
def | getAsROOT (path, kwargs) |
The most trivial function to retrieve the histogram from Histogram Transient Store. More... | |
def | fill (histo, data, fun=lambda x:x, cut=lambda x:True, kwargs) |
The function which allows 'the smart fill' of 1D-histogram. More... | |
def | _to_root_ (self) |
Convert AIDA to ROOT. More... | |
def | _moment_ (self, order, value=0) |
Evaluate 'bin-by-bin' momentum of certain order around the value. More... | |
def | _momentErr_ (self, order) |
Evaluate error in 'bin-by-bin' momentum of certain order around the value. More... | |
def | _centralMoment_ (self, order) |
Evaluate 'bin-by-bin' central momentum (around mean value) More... | |
def | _centralMomentErr_ (self, order) |
Evaluate error in 'bin-by-bin' momentum of certain order around the value. More... | |
def | _skewness_ (self) |
Evaluate 'bin-by-bin' skewness for 1D histogram. More... | |
def | _skewnessErr_ (self) |
Evaluate error for 'bin-by-bin' skewness for 1D histogram. More... | |
def | _kurtosis_ (self) |
Evaluate 'bin-by-bin' kurtosis for 1D histogram. More... | |
def | _kurtosisErr_ (self) |
Evaluate error for 'bin-by-bin' kurtosis for 1D histogram. More... | |
def | _nEff_ (self) |
def | _mean_ (self) |
def | _meanErr_ (self) |
def | _rms_ (self) |
def | _rmsErr_ (self) |
def | _sumBinHeightErr_ (self) |
def | _sumAllBinHeightErr_ (self) |
def | _overflowEntriesFrac_ (self) |
def | _overflowEntriesFracErr_ (self) |
def | _underflowEntriesFrac_ (self) |
def | _underflowEntriesFracErr_ (self) |
def | _overflowIntegralFrac_ (self) |
def | _overflowIntegralFracErr_ (self) |
def | _underflowIntegralFrac_ (self) |
def | _underflowIntegralFracErr_ (self) |
def | _nEntries_ (self, i1, i2=-10000000) |
get number of entries in histogram up to the certain bin (not-included) get number of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included) More... | |
def | _nEntriesFrac_ (self, i1, i2=-10000000) |
def | _nEntriesFracErr_ (self, i1, i2=-10000000) |
def | _path_ (self) |
============================================================================ More... | |
def | __dumpHisto__ (histo, args) |
============================================================================= More... | |
Variables | |
string | __author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu" |
This module contains set of simple and useful utilities for booking and manipulations with Gaudi-AIDA histograms, inspired by Thomas' request. More... | |
tuple | __all__ |
HID = cpp.GaudiAlg.ID | |
bool | useROOT = False |
global flag More... | |
aida2root = cpp.Gaudi.Utils.Aida2ROOT.aida2root | |
AIDA -> ROOT converter. More... | |
__repr__ | |
__str__ | |
HistoStats = cpp.Gaudi.Utils.HistoStats | |
i1DH = cpp.AIDA.IHistogram1D | |
moment | |
momentErr | |
centralMoment | |
centralMomentErr | |
nEff | |
mean | |
meanErr | |
rms | |
rmsErr | |
skewness | |
skewnessErr | |
kurtosis | |
kurtosisErr | |
overflowEntriesFrac | |
overflowEntriesFracErr | |
underflowEntriesFrac | |
underflowEntriesFracErr | |
overflowIntegralFrac | |
overflowIntegralFracErr | |
underflowIntegralFrac | |
underflowIntegralFracErr | |
nEntries | |
nEntriesFrac | |
nEntriesFracErr | |
iBH = cpp.AIDA.IBaseHistogram | |
path | |
TESpath | |
location | |
__doc__ | |
histoDump = __dumpHisto__ | |
the actual function for text dump of the histogram More... | |
dumpHisto = __dumpHisto__ | |
def GaudiPython.HistoUtils.__dumpHisto__ | ( | histo, | |
args | |||
) |
=============================================================================
Dump the histogram/profile in text format (a'la HBOOK) >>> histo >>> print dumpHisto ( histo ) >>> print histo.dump() >>> print histo.dump( 20 , 20 ) >>> print histo.dump( 20 , 20 , True ) Uses:
Definition at line 778 of file HistoUtils.py.
|
private |
Evaluate 'bin-by-bin' central momentum (around mean value)
Evaluate 'bin-by-bin' central momentum (around mean value) for 1D histogram >>> h1 = ... >>> print h1.centralMoment ( 5 )
Definition at line 502 of file HistoUtils.py.
|
private |
Evaluate error in 'bin-by-bin' momentum of certain order around the value.
Evaluate error for 'bin-by-bin' central momentum (around mean value) for 1D histogram >>> h1 = ... >>> print h1.centralMomentErr ( 5 )
Definition at line 515 of file HistoUtils.py.
|
private |
Helper private auxiliary function to get Application Manager.
Helper private auxiliary function to get Application Manager
Definition at line 54 of file HistoUtils.py.
|
private |
Helper private auxiliary function to get iDataSvs.
Helper private auxiliary function to get iDataSvs
Definition at line 83 of file HistoUtils.py.
|
private |
Helper private auxiliary function to get iHistogramSvs.
Helper private auxiliary function to get iHistogramSvs
Definition at line 71 of file HistoUtils.py.
|
private |
Evaluate 'bin-by-bin' kurtosis for 1D histogram.
Evaluate 'bin-by-bin' kurtosis >>> h1 = ... >>> print h1.kurtosis ()
Definition at line 552 of file HistoUtils.py.
|
private |
Evaluate error for 'bin-by-bin' kurtosis for 1D histogram.
Evaluate error for 'bin-by-bin' kurtotis for 1D AIDA histogram >>> h1 = ... >>> print h1.kurtotisErr()
Definition at line 564 of file HistoUtils.py.
|
private |
|
private |
|
private |
Evaluate 'bin-by-bin' momentum of certain order around the value.
Evaluate 'bin-by-bin' momentum of order 'order' around the value 'value' for 1D histogram >>> h1 = ... >>> print h1.moment ( 5 )
Definition at line 477 of file HistoUtils.py.
|
private |
Evaluate error in 'bin-by-bin' momentum of certain order around the value.
Evaluate error for 'bin-by-bin' momentum of order 'order' around the value 'value' for 1D histogram >>> h1 = ... >>> print h1.momentErr ( 5 )
Definition at line 490 of file HistoUtils.py.
|
private |
|
private |
get number of entries in histogram up to the certain bin (not-included) get number of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included)
Get number of entries in histogram up to the certain bin (not-included) attention: underflow bin is included! >>> h1 >>> print h1.nEntries ( 10 ) Get number of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included) >>> h1 >>> print h1.nEntries ( 10 , 15 )
Definition at line 672 of file HistoUtils.py.
|
private |
Get the fraction of entries in histogram up to the certain bin (not-included) attention: underflow bin is included! >>> h1 >>> print h1.nEntriesFrac ( 10 ) Get the fraction of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included) >>> h1 >>> print h1.nEntriesFrac ( 10 , 15 )
Definition at line 691 of file HistoUtils.py.
|
private |
Get error for fraction of entries in histogram up to the certain bin (not-included) attention: underflow bin is included! >>> h1 >>> print h1.nEntriesFracErr( 10 ) Get error fraction of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included) >>> h1 >>> print h1.nEntriesFracErr ( 10 , 15 )
Definition at line 710 of file HistoUtils.py.
|
private |
The fraction of overflow entries (useful for shape comparison)
Definition at line 619 of file HistoUtils.py.
|
private |
The error for fraction of overflow entries (useful for shape comparison)
Definition at line 625 of file HistoUtils.py.
|
private |
The fraction of overflow integral (useful for shape comparison)
Definition at line 644 of file HistoUtils.py.
|
private |
The error for fraction of overflow integral (useful for shape comparison)
Definition at line 650 of file HistoUtils.py.
|
private |
============================================================================
Get the path in THS for the given AIDA object: >>> aida = >>> print aida.path()
Definition at line 761 of file HistoUtils.py.
|
private |
|
private |
|
private |
Evaluate 'bin-by-bin' skewness for 1D histogram.
Evaluate 'bin-by-bin' skewness for 1D AIDA histogram >>> h1 = ... >>> print h1.skewness()
Definition at line 528 of file HistoUtils.py.
|
private |
Evaluate error for 'bin-by-bin' skewness for 1D histogram.
Evaluate error for 'bin-by-bin' skewness >>> h1 = ... >>> print h1.skewnessErr()
Definition at line 540 of file HistoUtils.py.
|
private |
Get an error in the sum bin height ('in-range integral')
Definition at line 614 of file HistoUtils.py.
|
private |
Get an error in the sum bin height ('in-range integral')
Definition at line 607 of file HistoUtils.py.
|
private |
Convert AIDA to ROOT >>> aida = ... ## get AIDA histogram >>> root = aida.toROOT() ## convert it to ROOT
Definition at line 445 of file HistoUtils.py.
|
private |
The fraction of underflow entries (useful for shape comparison)
Definition at line 631 of file HistoUtils.py.
|
private |
The error for fraction of underflow entries (useful for shape comparison)
Definition at line 637 of file HistoUtils.py.
|
private |
The fraction of underflow integral (useful for shape comparison)
Definition at line 656 of file HistoUtils.py.
|
private |
The error for fraction of underflow integral (useful for shape comparison)
Definition at line 662 of file HistoUtils.py.
def GaudiPython.HistoUtils.book | ( | args, | |
kwargs | |||
) |
The trivial function to book the various 1D,2D&3D-histograms.
The trivial function to book the various 1D,2D&3D-histograms (1) book the trivial 1D histogram with full path >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store 'cosine of decay angle ' , ## histogram title 100 , ## number of bins -1 , ## low edge 100 ) ## high edge (2) book the trivial 1D histogram with directory path and string ID : >>> h1D = book ( 'path/to/directory' , ## the path to directory in HTS 'H1' , ## string histogram identifier 'cosine of decay angle ' , ## histogram title 100 , ## number of bins -1 , ## low edge 100 ) ## high edge (3) book the trivial 1D histogram with directory path and integer ID : >>> h1D = book ( 'path/to/directory' , ## the path to directory in HTS 124 , ## integer histogram identifier 'cosine of decay angle ' , ## histogram title 100 , ## number of bins -1 , ## low edge 100 ) ## high edge (4) book the trivial 2D histogram with full path >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store 'm12**2 versus m13**2' , ## histogram title 50 , ## number of X-bins 1.0 , ## low X-edge 4.0 , ## high X-edge 50 , ## number of Y-bins 1 , ## low Y-edge 2 ) ## high Y-edge (5) book the trivial 2D histogram with directory path and literal ID >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store 'Dalitz1' , ## literal histogram identifier 'm12**2 versus m13**2' , ## histogram title 50 , ## number of X-bins 1.0 , ## low X-edge 4.0 , ## high X-edge 50 , ## number of Y-bins 1 , ## low Y-edge 2 ) ## high Y-edge (6) book the trivial 2D histogram with directory path and integer ID >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store 854 , ## integer histogram identifier 'm12**2 versus m13**2' , ## histogram title 50 , ## number of X-bins 1.0 , ## low X-edge 4.0 , ## high X-edge 50 , ## number of Y-bins 1.0 , ## low Y-edge 4.0 ) ## high Y-edge (7) book the trivial 3D histogram with full path >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store 'x vs y vs z ' , ## histogram title 10 , ## number of X-bins -1.0 , ## low X-edge 1.0 , ## high X-edge 10 , ## number of Y-bins -1.0 , ## low Y-edge 1.0 , ## high Y-edge 10 , ## number of Z-bins -1.0 , ## low Z-edge 1.0 ) ## high Z-edge (8) book the trivial 3D histogram with directory path and literal ID >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store 'xyz' , ## literal histogram identifier 'x vs y vs z' , ## histogram title 10 , ## number of X-bins -1.0 , ## low X-edge 1.0 , ## high X-edge 10 , ## number of Y-bins -1.0 , ## low Y-edge 1.0 , ## high Y-edge 10 , ## number of Z-bins -1.0 , ## low Z-edge 1.0 ) ## high Z-edge (9) book the trivial 3D histogram with directory path and integer ID >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store 888 , ## integer histogram identifier 'x vs y vs z' , ## histogram title 10 , ## number of X-bins -1.0 , ## low X-edge 1.0 , ## high X-edge 10 , ## number of Y-bins -1.0 , ## low Y-edge 1.0 , ## high Y-edge 10 , ## number of Z-bins -1.0 , ## low Z-edge 1.0 ) ## high Z-edge Many other booking methods are available, e.g. for the histograms with non-equidistant bins, see IHistogamSvc::book
Definition at line 95 of file HistoUtils.py.
def GaudiPython.HistoUtils.bookProf | ( | args, | |
kwargs | |||
) |
The trivial function to book 1D&2D profile histograms:
The trivial function to book 1D&2D profile histograms: (1) book 1D-profile histogram with full path in Histogram Transient Store: >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store 'Energy Correction' , ## the histogram title 100 , ## number of X-bins 0.0 , ## low X-edge 100 ) ## high X-edge (2) book 1D-profile histogram with directory path and literal ID >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store 'Calibration' , ## the histogram literal identifier 'Energy Correction' , ## the histogram title 100 , ## number of X-bins 0.0 , ## low X-edge 100 ) ## high X-edge (3) book 1D-profile histogram with directory path and integer ID >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store 418 , ## the histogram integer identifier 'Energy Correction' , ## the histogram title 100 , ## number of X-bins 0.0 , ## low X-edge 100 ) ## high X-edge (4) book 2D-profile histogram with full path in Histogram Transient Store: >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store 'Energy Correction' , ## the histogram title 50 , ## number of X-bins 0.0 , ## low X-edge 100 , ## high X-edge 50 , ## number of Y-bins 0.0 , ## low Y-edge 100 ) ## high Y-edge (5) book 2D-profile histogram with directory path and literal ID >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store 'Calibration' , ## the histogram literal identifier 'Energy Correction' , ## the histogram title 50 , ## number of X-bins 0.0 , ## low X-edge 100 , ## high X-edge 50 , ## number of Y-bins 0.0 , ## low Y-edge 100 ) ## high Y-edge (6) book 2D-profile histogram with directory path and integer ID >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store 418 , ## the histogram integer identifier 'Energy Correction' , ## the histogram title 50 , ## number of X-bins 0.0 , ## low X-edge 100 , ## high X-edge 50 , ## number of Y-bins 0.0 , ## low Y-edge 100 ) ## high Y-edge Many other booking methods are available, e.g. for the histograms with non-equidistant bins, see IHistogamSvc::book
Definition at line 232 of file HistoUtils.py.
def GaudiPython.HistoUtils.fill | ( | histo, | |
data, | |||
fun = lambda x : x , |
|||
cut = lambda x : True , |
|||
kwargs | |||
) |
The function which allows 'the smart fill' of 1D-histogram.
The function which allows 'the smart fill' of 1D-histogram >>> histo = ... The most trivial case, fill with the value >>> fill ( histo , 1.0 ) Fill from any iterable object (sequence) >>> fill ( histo , [1,,2,3,4,5,10] ) Fill from iterable object and apply the function: >>> fill ( histo , [1,2,3,4,5] , math.sin ) Use lambda form: >>> fill ( histo , [1,2,3,4,5] , lambda x : x*x ) The same >>> fill ( histo , [1,2,3,4,5] , fun = lambda x : x*x ) Use internal attributes: >>> tracks = evtSvc['Rec/Track/Best'] ## iterable container of tracks >>> fill ( histo , tracks , lambda t : t.pt() ) Apply the predicate: fill only even numbers: >>> fill ( histo , [1,2,3,4,5,6,7] , lambda x : x , lambda y : y%2 ) The same (omit the trivial function) : >>> fill ( histo , [1,2,3,4,5,6,7] , cut = lambda y : y%2 ) Apply the predicate: fill only pt for positively charged tracks: >>> tracks = evtSvc['Rec/Track/Best'] >>> fill ( histo , tracks , lambda t : t.pt() , lambda t : 0<t.charge() ) The same: >>> fill ( histo , tracks , fun = lambda t : t.pt() , cut = lambda t : 0<t.charge() ) Ordinary functions are also fine: >>> def myfun ( track ) : return sin( track.pt() + track.p() ) >>> def mycut ( track ) : return track.p() > 100 * GeV >>> fill ( histo , tracks , myfun , mycut ) The 'data' could be the address in TES, in this case the object is retrieved from TES and the method is applied to the objects, retrieved from TES: >>> fill ( histo , ## the reference to the histogram 'Rec/Track/Best' , ## the location of objects in TES lambda t : t.pt() ) ## function to be used for histogram fill >>> fill ( histo , ## the reference to the histogram 'Rec/Track/Best' , ## the address of objects in TES lambda t : t.pt() , ## the function to be used for histogram fill lambda t : t.charge()>0 ) ## the criteria to select tracks The arguments 'fun' and 'cut' could be strings, in this case they are evaluated by python before usage. This option could be often very useful.
Definition at line 354 of file HistoUtils.py.
def GaudiPython.HistoUtils.getAsAIDA | ( | path, | |
kwargs | |||
) |
The most trivial function to retrieve the histogram from Histogram Transient Store.
The most trivial function to retrieve the histogram from Histogram Transient Store The histogram is returned by reference to its AIDA-representation (if possible) >>> h = getAsAIDA ( 'some/path/to/my/histogram' )
Definition at line 309 of file HistoUtils.py.
def GaudiPython.HistoUtils.getAsROOT | ( | path, | |
kwargs | |||
) |
The most trivial function to retrieve the histogram from Histogram Transient Store.
The most trivial function to retrieve the histogram from Histogram Transient Store The histogram is returned by reference to its underlying native ROOT-representation (if possible) >>> h = getAsROOT ( 'some/path/to/my/histogram' )
Definition at line 330 of file HistoUtils.py.
|
private |
Definition at line 29 of file HistoUtils.py.
|
private |
This module contains set of simple and useful utilities for booking and manipulations with Gaudi-AIDA histograms, inspired by Thomas' request.
Definition at line 27 of file HistoUtils.py.
|
private |
Definition at line 795 of file HistoUtils.py.
|
private |
Definition at line 469 of file HistoUtils.py.
|
private |
Definition at line 470 of file HistoUtils.py.
GaudiPython.HistoUtils.aida2root = cpp.Gaudi.Utils.Aida2ROOT.aida2root |
Definition at line 442 of file HistoUtils.py.
GaudiPython.HistoUtils.centralMoment |
Definition at line 734 of file HistoUtils.py.
GaudiPython.HistoUtils.centralMomentErr |
Definition at line 735 of file HistoUtils.py.
GaudiPython.HistoUtils.dumpHisto = __dumpHisto__ |
Definition at line 800 of file HistoUtils.py.
GaudiPython.HistoUtils.HID = cpp.GaudiAlg.ID |
Definition at line 47 of file HistoUtils.py.
GaudiPython.HistoUtils.histoDump = __dumpHisto__ |
the actual function for text dump of the histogram
Definition at line 799 of file HistoUtils.py.
GaudiPython.HistoUtils.HistoStats = cpp.Gaudi.Utils.HistoStats |
Definition at line 473 of file HistoUtils.py.
GaudiPython.HistoUtils.i1DH = cpp.AIDA.IHistogram1D |
Definition at line 730 of file HistoUtils.py.
GaudiPython.HistoUtils.iBH = cpp.AIDA.IBaseHistogram |
Definition at line 771 of file HistoUtils.py.
GaudiPython.HistoUtils.kurtosis |
Definition at line 743 of file HistoUtils.py.
GaudiPython.HistoUtils.kurtosisErr |
Definition at line 744 of file HistoUtils.py.
GaudiPython.HistoUtils.location |
Definition at line 774 of file HistoUtils.py.
GaudiPython.HistoUtils.mean |
Definition at line 737 of file HistoUtils.py.
GaudiPython.HistoUtils.meanErr |
Definition at line 738 of file HistoUtils.py.
GaudiPython.HistoUtils.moment |
Definition at line 732 of file HistoUtils.py.
GaudiPython.HistoUtils.momentErr |
Definition at line 733 of file HistoUtils.py.
GaudiPython.HistoUtils.nEff |
Definition at line 736 of file HistoUtils.py.
GaudiPython.HistoUtils.nEntries |
Definition at line 756 of file HistoUtils.py.
GaudiPython.HistoUtils.nEntriesFrac |
Definition at line 757 of file HistoUtils.py.
GaudiPython.HistoUtils.nEntriesFracErr |
Definition at line 758 of file HistoUtils.py.
GaudiPython.HistoUtils.overflowEntriesFrac |
Definition at line 746 of file HistoUtils.py.
GaudiPython.HistoUtils.overflowEntriesFracErr |
Definition at line 747 of file HistoUtils.py.
GaudiPython.HistoUtils.overflowIntegralFrac |
Definition at line 751 of file HistoUtils.py.
GaudiPython.HistoUtils.overflowIntegralFracErr |
Definition at line 752 of file HistoUtils.py.
GaudiPython.HistoUtils.path |
Definition at line 772 of file HistoUtils.py.
GaudiPython.HistoUtils.rms |
Definition at line 739 of file HistoUtils.py.
GaudiPython.HistoUtils.rmsErr |
Definition at line 740 of file HistoUtils.py.
GaudiPython.HistoUtils.skewness |
Definition at line 741 of file HistoUtils.py.
GaudiPython.HistoUtils.skewnessErr |
Definition at line 742 of file HistoUtils.py.
GaudiPython.HistoUtils.TESpath |
Definition at line 773 of file HistoUtils.py.
GaudiPython.HistoUtils.underflowEntriesFrac |
Definition at line 748 of file HistoUtils.py.
GaudiPython.HistoUtils.underflowEntriesFracErr |
Definition at line 749 of file HistoUtils.py.
GaudiPython.HistoUtils.underflowIntegralFrac |
Definition at line 753 of file HistoUtils.py.
GaudiPython.HistoUtils.underflowIntegralFracErr |
Definition at line 754 of file HistoUtils.py.
bool GaudiPython.HistoUtils.useROOT = False |
global flag
Definition at line 50 of file HistoUtils.py.