| The Gaudi Framework v32r1 (f65d50dc)

Classes | Functions | Variables
GaudiPython.HistoUtils Namespace Reference

## Classes
class | HistoFile

## Functions
def | _getAppMgr (**kwargs)
def | _getHistoSvc (**kwargs)
def | _getEvtSvc (**kwargs)
def | book (*args, **kwargs)
def | bookProf (*args, **kwargs)
def | getAsAIDA (path, **kwargs)
def | getAsROOT (path, **kwargs)
def | fill (histo, data, fun=lambda x:x, cut=lambda x:True, **kwargs)
def | _to_root_ (self)
def | _moment_ (self, order, value=0)
def | _momentErr_ (self, order)
def | _centralMoment_ (self, order)
def | _centralMomentErr_ (self, order)
def | _skewness_ (self)
def | _skewnessErr_ (self)
def | _kurtosis_ (self)
def | _kurtosisErr_ (self)
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)
def | _nEntriesFrac_ (self, i1, i2=-10000000)
def | _nEntriesFracErr_ (self, i1, i2=-10000000)
def | _path_ (self)
def | __dumpHisto__ (histo, *args)

## Variables
string | __author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu"
tuple | __all__
| HID = cpp.GaudiAlg.ID
bool | useROOT = False
| global flag More...
| aida2root = cpp.Gaudi.Utils.Aida2ROOT.aida2root
| __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
def | histoDump = __dumpHisto__
def | dumpHisto = __dumpHisto__

## Function Documentation

## ◆ __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 940 of file HistoUtils.py.

940 def __dumpHisto__(histo, *args):
941 """
942
943 Dump the histogram/profile in text format (a'la HBOOK)
944
945 >>> histo
946 >>> print dumpHisto ( histo )
947
948 >>> print histo.dump()
949 >>> print histo.dump( 20 , 20 )
950 >>> print histo.dump( 20 , 20 , True )
951
952 Uses:
953
954 """
955 return cpp.Gaudi.Utils.Histos.histoDump(histo, *args)
956
957
958 __dumpHisto__.__doc__ = '\n' + cpp.Gaudi.Utils.Histos.histoDump.__doc__
959
960 # =============================================================================
961 # the actual function for text dump of the histogram
GaudiPython.HistoUtils.__dumpHisto__
def __dumpHisto__(histo, *args)
Definition: HistoUtils.py:940

## ◆ _centralMoment_()

def GaudiPython.HistoUtils._centralMoment_ | ( |  | self,
|  |  | order
| ) |  |
| private

    Evaluate 'bin-by-bin' central momentum (around mean value)
    for 1D histogram

    >>> h1 = ...
    >>> print h1.centralMoment ( 5 )

Definition at line 550 of file HistoUtils.py.

550 def _centralMoment_(self, order):
551 """
552 Evaluate 'bin-by-bin' central momentum (around mean value)
553 for 1D histogram
554
555 >>> h1 = ...
556 >>> print h1.centralMoment ( 5 )
557
558 """
559 return HistoStats.centralMoment(self, order)
560
561
562 # =============================================================================
563 # Evaluate error in 'bin-by-bin' momentum of certain order around the value
564
565
GaudiPython.HistoUtils._centralMoment_
def _centralMoment_(self, order)
Definition: HistoUtils.py:550

## ◆ _centralMomentErr_()

def GaudiPython.HistoUtils._centralMomentErr_ | ( |  | self,
|  |  | order
| ) |  |
| private

    Evaluate error for 'bin-by-bin' central momentum (around mean value)
    for 1D histogram

    >>> h1 = ...
    >>> print h1.centralMomentErr ( 5 )

Definition at line 566 of file HistoUtils.py.

566 def _centralMomentErr_(self, order):
567 """
568 Evaluate error for 'bin-by-bin' central momentum (around mean value)
569 for 1D histogram
570
571 >>> h1 = ...
572 >>> print h1.centralMomentErr ( 5 )
573
574 """
575 return HistoStats.centralMomentErr(self, order)
576
577
578 # =============================================================================
579 # Evaluate 'bin-by-bin' skewness for 1D histogram
580
581
GaudiPython.HistoUtils._centralMomentErr_
def _centralMomentErr_(self, order)
Definition: HistoUtils.py:566

## ◆ _getAppMgr()

def GaudiPython.HistoUtils._getAppMgr | ( | ** | kwargs | ) |
| private

    Helper private auxiliary function to get Application Manager

Definition at line 56 of file HistoUtils.py.

56 def _getAppMgr(**kwargs):
57 """
58 Helper private auxiliary function to get Application Manager
59 """
60 gaudi = kwargs.get('gaudi', None)
61 if not gaudi:
62 gaudi = AppMgr()
63 if not gaudi:
64 raise RuntimeError('Unable to get valid ApplicationMgr')
65
66 state = gaudi._isvc.FSMState()
67 if state < cpp.Gaudi.StateMachine.CONFIGURED:
68 gaudi.config()
69 state = gaudi._isvc.FSMState()
70 if state < cpp.Gaudi.StateMachine.INITIALIZED:
71 gaudi.initialize()
72
73 return gaudi # RETURN
74
75
76 # =============================================================================
77 # Helper private auxiliary function to get iHistogramSvs
78
79
GaudiPython.HistoUtils._getAppMgr
def _getAppMgr(**kwargs)
Definition: HistoUtils.py:56

## ◆ _getEvtSvc()

def GaudiPython.HistoUtils._getEvtSvc | ( | ** | kwargs | ) |
| private

    Helper private auxiliary function to get iDataSvs

Definition at line 97 of file HistoUtils.py.

97 def _getEvtSvc(**kwargs):
98 """
99 Helper private auxiliary function to get iDataSvs
100 """
101 svc = kwargs.get('service', None)
102 if not svc:
103 svc = kwargs.get('svc', None)
104 else:
105 return svc # RETURN
106 gaudi = _getAppMgr(**kwargs)
107 return gaudi.evtsvc() # RETURN
108
109
110 # =============================================================================
111 # The trivial function to book the various 1D,2D&3D-histograms
112
113
GaudiPython.HistoUtils._getAppMgr
def _getAppMgr(**kwargs)
Definition: HistoUtils.py:56
GaudiPython.HistoUtils._getEvtSvc
def _getEvtSvc(**kwargs)
Definition: HistoUtils.py:97

## ◆ _getHistoSvc()

def GaudiPython.HistoUtils._getHistoSvc | ( | ** | kwargs | ) |
| private

    Helper private auxiliary function to get iHistogramSvs

Definition at line 80 of file HistoUtils.py.

80 def _getHistoSvc(**kwargs):
81 """
82 Helper private auxiliary function to get iHistogramSvs
83 """
84 svc = kwargs.get('service', None)
85 if not svc:
86 svc = kwargs.get('svc', None)
87 else:
88 return svc # RETURN
89 gaudi = _getAppMgr(**kwargs)
90 return gaudi.histsvc() # RETURN
91
92
93 # =============================================================================
94 # Helper private auxiliary function to get iDataSvs
95
96
GaudiPython.HistoUtils._getAppMgr
def _getAppMgr(**kwargs)
Definition: HistoUtils.py:56
GaudiPython.HistoUtils._getHistoSvc
def _getHistoSvc(**kwargs)
Definition: HistoUtils.py:80

## ◆ _kurtosis_()

def GaudiPython.HistoUtils._kurtosis_ | ( |  | self | ) |
| private

    Evaluate 'bin-by-bin' kurtosis

    >>> h1 = ...
    >>> print h1.kurtosis ()

Definition at line 612 of file HistoUtils.py.

612 def _kurtosis_(self):
613 """
614 Evaluate 'bin-by-bin' kurtosis
615
616 >>> h1 = ...
617 >>> print h1.kurtosis ()
618
619 """
620 return HistoStats.kurtosis(self)
621
622
623 # =============================================================================
624 # Evaluate error for 'bin-by-bin' kurtosis for 1D histogram
625
626
GaudiPython.HistoUtils._kurtosis_
def _kurtosis_(self)
Definition: HistoUtils.py:612

## ◆ _kurtosisErr_()

def GaudiPython.HistoUtils._kurtosisErr_ | ( |  | self | ) |
| private

    Evaluate error for 'bin-by-bin' kurtotis for 1D AIDA histogram

    >>> h1 = ...
    >>> print h1.kurtotisErr()

Definition at line 627 of file HistoUtils.py.

627 def _kurtosisErr_(self):
628 """
629 Evaluate error for 'bin-by-bin' kurtotis for 1D AIDA histogram
630
631 >>> h1 = ...
632 >>> print h1.kurtotisErr()
633
634 """
635 return HistoStats.kurtosisErr(self)
636
637
638 # =============================================================================
639
640
GaudiPython.HistoUtils._kurtosisErr_
def _kurtosisErr_(self)
Definition: HistoUtils.py:627

## ◆ _mean_()

def GaudiPython.HistoUtils._mean_ | ( |  | self | ) |
| private

    Evaluate the MEAN value

Definition at line 651 of file HistoUtils.py.

651 def _mean_(self):
652 """
653 Evaluate the MEAN value
654 """
655 return HistoStats.mean(self)
656
657
658 # =============================================================================
659
660
GaudiPython.HistoUtils._mean_
def _mean_(self)
Definition: HistoUtils.py:651

## ◆ _meanErr_()

def GaudiPython.HistoUtils._meanErr_ | ( |  | self | ) |
| private

    Evaluate the error for MEAN estimate

Definition at line 661 of file HistoUtils.py.

661 def _meanErr_(self):
662 """
663 Evaluate the error for MEAN estimate
664 """
665 return HistoStats.meanErr(self)
666
667
668 # =============================================================================
669
670
GaudiPython.HistoUtils._meanErr_
def _meanErr_(self)
Definition: HistoUtils.py:661

## ◆ _moment_()

def GaudiPython.HistoUtils._moment_ | ( |  | self,
|  |  | order,
|  |  | value = `0`
| ) |  |
| private

    Evaluate 'bin-by-bin' momentum of order 'order' around the value 'value'
    for 1D histogram

    >>> h1 = ...
    >>> print h1.moment ( 5 )

Definition at line 518 of file HistoUtils.py.

518 def _moment_(self, order, value=0):
519 """
520 Evaluate 'bin-by-bin' momentum of order 'order' around the value 'value'
521 for 1D histogram
522
523 >>> h1 = ...
524 >>> print h1.moment ( 5 )
525
526 """
527 return HistoStats.moment(self, order, value)
528
529
530 # =============================================================================
531 # Evaluate error in 'bin-by-bin' momentum of certain order around the value
532
533
GaudiPython.HistoUtils._moment_
def _moment_(self, order, value=0)
Definition: HistoUtils.py:518

## ◆ _momentErr_()

def GaudiPython.HistoUtils._momentErr_ | ( |  | self,
|  |  | order
| ) |  |
| private

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

534 def _momentErr_(self, order):
535 """
536 Evaluate error for 'bin-by-bin' momentum of order 'order' around the value 'value'
537 for 1D histogram
538
539 >>> h1 = ...
540 >>> print h1.momentErr ( 5 )
541
542 """
543 return HistoStats.momentErr(self, order)
544
545
546 # =============================================================================
547 # Evaluate 'bin-by-bin' central momentum (around mean value)
548
549
GaudiPython.HistoUtils._momentErr_
def _momentErr_(self, order)
Definition: HistoUtils.py:534

## ◆ _nEff_()

def GaudiPython.HistoUtils._nEff_ | ( |  | self | ) |
| private

    Number of equivalent entries

Definition at line 641 of file HistoUtils.py.

641 def _nEff_(self):
642 """
643 Number of equivalent entries
644 """
645 return HistoStats.nEff(self)
646
647
648 # =============================================================================
649
650
GaudiPython.HistoUtils._nEff_
def _nEff_(self)
Definition: HistoUtils.py:641

## ◆ _nEntries_()

def GaudiPython.HistoUtils._nEntries_ | ( |  | self,
|  |  | i1,
|  |  | i2 = `-10000000`
| ) |  |
| private

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

792 def _nEntries_(self, i1, i2=-10000000):
793 """
794 Get number of entries in histogram up to the certain bin (not-included)
795
796 attention: underflow bin is included!
797
798 >>> h1
799 >>> print h1.nEntries ( 10 )
800
801 Get number of entries in histogram form the certain
802 minimal bin up to the certain maximal bin (not-included)
803
804 >>> h1
805 >>> print h1.nEntries ( 10 , 15 )
806
807 """
808 if i2 < i1 or i2 < 0:
809 return HistoStats.nEntries(self, i1)
810 return HistoStats.nEntries(self, i1, i2)
811
812
813 # =============================================================================
814
815
GaudiPython.HistoUtils._nEntries_
def _nEntries_(self, i1, i2=-10000000)
Definition: HistoUtils.py:792

## ◆ _nEntriesFrac_()

def GaudiPython.HistoUtils._nEntriesFrac_ | ( |  | self,
|  |  | i1,
|  |  | i2 = `-10000000`
| ) |  |
| 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 816 of file HistoUtils.py.

816 def _nEntriesFrac_(self, i1, i2=-10000000):
817 """
818 Get the fraction of entries in histogram up to the certain bin (not-included)
819
820 attention: underflow bin is included!
821
822 >>> h1
823 >>> print h1.nEntriesFrac ( 10 )
824
825 Get the fraction of entries in histogram form the certain
826 minimal bin up to the certain maximal bin (not-included)
827
828 >>> h1
829 >>> print h1.nEntriesFrac ( 10 , 15 )
830
831 """
832 if i2 < i1 or i2 < 0:
833 return HistoStats.nEntriesFrac(self, i1)
834 return HistoStats.nEntriesFrac(self, i1, i2)
835
836
837 # =============================================================================
838
839
GaudiPython.HistoUtils._nEntriesFrac_
def _nEntriesFrac_(self, i1, i2=-10000000)
Definition: HistoUtils.py:816

## ◆ _nEntriesFracErr_()

def GaudiPython.HistoUtils._nEntriesFracErr_ | ( |  | self,
|  |  | i1,
|  |  | i2 = `-10000000`
| ) |  |
| 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 840 of file HistoUtils.py.

840 def _nEntriesFracErr_(self, i1, i2=-10000000):
841 """
842 Get error for fraction of entries in histogram up to the certain bin (not-included)
843
844 attention: underflow bin is included!
845
846 >>> h1
847 >>> print h1.nEntriesFracErr( 10 )
848
849 Get error fraction of entries in histogram form the certain
850 minimal bin up to the certain maximal bin (not-included)
851
852 >>> h1
853 >>> print h1.nEntriesFracErr ( 10 , 15 )
854
855 """
856 if i2 < i1 or i2 < 0:
857 return HistoStats.nEntriesFracErr(self, i1)
858 return HistoStats.nEntriesFracErr(self, i1, i2)
859
860
861 # =============================================================================
GaudiPython.HistoUtils._nEntriesFracErr_
def _nEntriesFracErr_(self, i1, i2=-10000000)
Definition: HistoUtils.py:840

## ◆ _overflowEntriesFrac_()

def GaudiPython.HistoUtils._overflowEntriesFrac_ | ( |  | self | ) |
| private

    The fraction of overflow entries  (useful for shape comparison)

Definition at line 709 of file HistoUtils.py.

709 def _overflowEntriesFrac_(self):
710 """
711 The fraction of overflow entries (useful for shape comparison)
712 """
713 return HistoStats.overflowEntriesFrac(self)
714
715
716 # =============================================================================
717
718
GaudiPython.HistoUtils._overflowEntriesFrac_
def _overflowEntriesFrac_(self)
Definition: HistoUtils.py:709

## ◆ _overflowEntriesFracErr_()

def GaudiPython.HistoUtils._overflowEntriesFracErr_ | ( |  | self | ) |
| private

    The error for fraction of overflow entries  (useful for shape comparison)

Definition at line 719 of file HistoUtils.py.

719 def _overflowEntriesFracErr_(self):
720 """
721 The error for fraction of overflow entries (useful for shape comparison)
722 """
723 return HistoStats.overflowEntriesFracErr(self)
724
725
726 # =============================================================================
727
728
GaudiPython.HistoUtils._overflowEntriesFracErr_
def _overflowEntriesFracErr_(self)
Definition: HistoUtils.py:719

## ◆ _overflowIntegralFrac_()

def GaudiPython.HistoUtils._overflowIntegralFrac_ | ( |  | self | ) |
| private

    The fraction of overflow integral  (useful for shape comparison)

Definition at line 749 of file HistoUtils.py.

749 def _overflowIntegralFrac_(self):
750 """
751 The fraction of overflow integral (useful for shape comparison)
752 """
753 return HistoStats.overflowIntegralFrac(self)
754
755
756 # =============================================================================
757
758
GaudiPython.HistoUtils._overflowIntegralFrac_
def _overflowIntegralFrac_(self)
Definition: HistoUtils.py:749

## ◆ _overflowIntegralFracErr_()

def GaudiPython.HistoUtils._overflowIntegralFracErr_ | ( |  | self | ) |
| private

    The error for fraction of overflow integral  (useful for shape comparison)

Definition at line 759 of file HistoUtils.py.

759 def _overflowIntegralFracErr_(self):
760 """
761 The error for fraction of overflow integral (useful for shape comparison)
762 """
763 return HistoStats.overflowIntegralFracErr(self)
764
765
766 # =============================================================================
767
768
GaudiPython.HistoUtils._overflowIntegralFracErr_
def _overflowIntegralFracErr_(self)
Definition: HistoUtils.py:759

## ◆ _path_()

def GaudiPython.HistoUtils._path_ | ( |  | self | ) |
| private

    Get the path in THS for the given AIDA object:

    >>> aida =
    >>> print aida.path()

Definition at line 919 of file HistoUtils.py.

919 def _path_(self):
920 """
921 Get the path in THS for the given AIDA object:
922
923 >>> aida =
924 >>> print aida.path()
925
926 """
927 return cpp.Gaudi.Utils.Histos.path(self)
928
929
GaudiPython.HistoUtils._path_
def _path_(self)
Definition: HistoUtils.py:919

## ◆ _rms_()

def GaudiPython.HistoUtils._rms_ | ( |  | self | ) |
| private

    Evaluate the RMS for AIDA histogram

Definition at line 671 of file HistoUtils.py.

671 def _rms_(self):
672 """
673 Evaluate the RMS for AIDA histogram
674 """
675 return HistoStats.rms(self)
676
677
678 # =============================================================================
679
680
GaudiPython.HistoUtils._rms_
def _rms_(self)
Definition: HistoUtils.py:671

## ◆ _rmsErr_()

def GaudiPython.HistoUtils._rmsErr_ | ( |  | self | ) |
| private

    Evaluate the error for RMS estimate

Definition at line 681 of file HistoUtils.py.

681 def _rmsErr_(self):
682 """
683 Evaluate the error for RMS estimate
684 """
685 return HistoStats.rmsErr(self)
686
687
688 # =============================================================================
689
690
GaudiPython.HistoUtils._rmsErr_
def _rmsErr_(self)
Definition: HistoUtils.py:681

## ◆ _skewness_()

def GaudiPython.HistoUtils._skewness_ | ( |  | self | ) |
| private

    Evaluate 'bin-by-bin' skewness for 1D AIDA histogram

    >>> h1 = ...
    >>> print h1.skewness()

Definition at line 582 of file HistoUtils.py.

582 def _skewness_(self):
583 """
584 Evaluate 'bin-by-bin' skewness for 1D AIDA histogram
585
586 >>> h1 = ...
587 >>> print h1.skewness()
588
589 """
590 return HistoStats.skewness(self)
591
592
593 # =============================================================================
594 # Evaluate error for 'bin-by-bin' skewness for 1D histogram
595
596
GaudiPython.HistoUtils._skewness_
def _skewness_(self)
Definition: HistoUtils.py:582

## ◆ _skewnessErr_()

def GaudiPython.HistoUtils._skewnessErr_ | ( |  | self | ) |
| private

    Evaluate error for 'bin-by-bin' skewness

    >>> h1 = ...
    >>> print h1.skewnessErr()

Definition at line 597 of file HistoUtils.py.

597 def _skewnessErr_(self):
598 """
599 Evaluate error for 'bin-by-bin' skewness
600
601 >>> h1 = ...
602 >>> print h1.skewnessErr()
603
604 """
605 return HistoStats.skewnessErr(self)
606
607
608 # =============================================================================
609 # Evaluate 'bin-by-bin' kurtosis for 1D histogram
610
611
GaudiPython.HistoUtils._skewnessErr_
def _skewnessErr_(self)
Definition: HistoUtils.py:597

## ◆ _sumAllBinHeightErr_()

def GaudiPython.HistoUtils._sumAllBinHeightErr_ | ( |  | self | ) |
| private

    Get an error in the sum bin height ('in-range integral')

Definition at line 701 of file HistoUtils.py.

701 def _sumAllBinHeightErr_(self):
702 """ Get an error in the sum bin height ('in-range integral') """
703 return HistoStats.sumAllBinHeightErr(self)
704
705
706 # =============================================================================
707
708
GaudiPython.HistoUtils._sumAllBinHeightErr_
def _sumAllBinHeightErr_(self)
Definition: HistoUtils.py:701

## ◆ _sumBinHeightErr_()

def GaudiPython.HistoUtils._sumBinHeightErr_ | ( |  | self | ) |
| private

    Get an error in the sum bin height ('in-range integral')

Definition at line 691 of file HistoUtils.py.

691 def _sumBinHeightErr_(self):
692 """
693 Get an error in the sum bin height ('in-range integral')
694 """
695 return HistoStats.sumBinHeightErr(self)
696
697
698 # =============================================================================
699
700
GaudiPython.HistoUtils._sumBinHeightErr_
def _sumBinHeightErr_(self)
Definition: HistoUtils.py:691

## ◆ _to_root_()

def GaudiPython.HistoUtils._to_root_ | ( |  | self | ) |
| private

    Convert AIDA to ROOT

    >>> aida = ...            ## get AIDA histogram
    >>> root = aida.toROOT()  ## convert it to ROOT

Definition at line 487 of file HistoUtils.py.

487 def _to_root_(self):
488 """
489 Convert AIDA to ROOT
490
491 >>> aida = ... ## get AIDA histogram
492 >>> root = aida.toROOT() ## convert it to ROOT
493
494 """
495 return aida2root(self)
496
497
498 _to_root_.__doc__ += aida2root.__doc__
499
GaudiPython.HistoUtils._to_root_
def _to_root_(self)
Definition: HistoUtils.py:487
GaudiPython.HistoUtils.aida2root
aida2root
Definition: HistoUtils.py:481

## ◆ _underflowEntriesFrac_()

def GaudiPython.HistoUtils._underflowEntriesFrac_ | ( |  | self | ) |
| private

    The fraction of underflow entries  (useful for shape comparison)

Definition at line 729 of file HistoUtils.py.

729 def _underflowEntriesFrac_(self):
730 """
731 The fraction of underflow entries (useful for shape comparison)
732 """
733 return HistoStats.underflowEntriesFrac(self)
734
735
736 # =============================================================================
737
738
GaudiPython.HistoUtils._underflowEntriesFrac_
def _underflowEntriesFrac_(self)
Definition: HistoUtils.py:729

## ◆ _underflowEntriesFracErr_()

def GaudiPython.HistoUtils._underflowEntriesFracErr_ | ( |  | self | ) |
| private

    The error for fraction of underflow entries  (useful for shape comparison)

Definition at line 739 of file HistoUtils.py.

739 def _underflowEntriesFracErr_(self):
740 """
741 The error for fraction of underflow entries (useful for shape comparison)
742 """
743 return HistoStats.underflowEntriesFracErr(self)
744
745
746 # =============================================================================
747
748
GaudiPython.HistoUtils._underflowEntriesFracErr_
def _underflowEntriesFracErr_(self)
Definition: HistoUtils.py:739

## ◆ _underflowIntegralFrac_()

def GaudiPython.HistoUtils._underflowIntegralFrac_ | ( |  | self | ) |
| private

    The fraction of underflow integral  (useful for shape comparison)

Definition at line 769 of file HistoUtils.py.

769 def _underflowIntegralFrac_(self):
770 """
771 The fraction of underflow integral (useful for shape comparison)
772 """
773 return HistoStats.underflowIntegralFrac(self)
774
775
776 # =============================================================================
777
778
GaudiPython.HistoUtils._underflowIntegralFrac_
def _underflowIntegralFrac_(self)
Definition: HistoUtils.py:769

## ◆ _underflowIntegralFracErr_()

def GaudiPython.HistoUtils._underflowIntegralFracErr_ | ( |  | self | ) |
| private

    The error for fraction of underflow integral (useful for shape comparison)

Definition at line 779 of file HistoUtils.py.

779 def _underflowIntegralFracErr_(self):
780 """
781 The error for fraction of underflow integral (useful for shape comparison)
782 """
783 return HistoStats.underflowIntegralFracErr(self)
784
785
786 # =============================================================================
787 # get number of entries in histogram up to the certain bin (not-included)
788 # get number of entries in histogram form the certain
789 # minimal bin up to the certain maximal bin (not-included)
790
791
GaudiPython.HistoUtils._underflowIntegralFracErr_
def _underflowIntegralFracErr_(self)
Definition: HistoUtils.py:779

## ◆ book()

def GaudiPython.HistoUtils.book | ( | * | args,
|  | ** | kwargs
| ) |  |

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

114 def book(*args, **kwargs):
115 """
116 The trivial function to book the various 1D,2D&3D-histograms
117
118 (1) book the trivial 1D histogram with full path
119
120 >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store
121 'cosine of decay angle ' , ## histogram title
122 100 , ## number of bins
123 -1 , ## low edge
124 100 ) ## high edge
125
126 (2) book the trivial 1D histogram with directory path and string ID :
127
128 >>> h1D = book ( 'path/to/directory' , ## the path to directory in HTS
129 'H1' , ## string histogram identifier
130 'cosine of decay angle ' , ## histogram title
131 100 , ## number of bins
132 -1 , ## low edge
133 100 ) ## high edge
134
135 (3) book the trivial 1D histogram with directory path and integer ID :
136
137 >>> h1D = book ( 'path/to/directory' , ## the path to directory in HTS
138 124 , ## integer histogram identifier
139 'cosine of decay angle ' , ## histogram title
140 100 , ## number of bins
141 -1 , ## low edge
142 100 ) ## high edge
143
144 (4) book the trivial 2D histogram with full path
145
146 >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store
147 'm12**2 versus m13**2' , ## histogram title
148 50 , ## number of X-bins
149 1.0 , ## low X-edge
150 4.0 , ## high X-edge
151 50 , ## number of Y-bins
152 1 , ## low Y-edge
153 2 ) ## high Y-edge
154
155 (5) book the trivial 2D histogram with directory path and literal ID
156
157 >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store
158 'Dalitz1' , ## literal histogram identifier
159 'm12**2 versus m13**2' , ## histogram title
160 50 , ## number of X-bins
161 1.0 , ## low X-edge
162 4.0 , ## high X-edge
163 50 , ## number of Y-bins
164 1 , ## low Y-edge
165 2 ) ## high Y-edge
166
167 (6) book the trivial 2D histogram with directory path and integer ID
168
169 >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store
170 854 , ## integer histogram identifier
171 'm12**2 versus m13**2' , ## histogram title
172 50 , ## number of X-bins
173 1.0 , ## low X-edge
174 4.0 , ## high X-edge
175 50 , ## number of Y-bins
176 1.0 , ## low Y-edge
177 4.0 ) ## high Y-edge
178
179 (7) book the trivial 3D histogram with full path
180
181 >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store
182 'x vs y vs z ' , ## histogram title
183 10 , ## number of X-bins
184 -1.0 , ## low X-edge
185 1.0 , ## high X-edge
186 10 , ## number of Y-bins
187 -1.0 , ## low Y-edge
188 1.0 , ## high Y-edge
189 10 , ## number of Z-bins
190 -1.0 , ## low Z-edge
191 1.0 ) ## high Z-edge
192
193 (8) book the trivial 3D histogram with directory path and literal ID
194
195 >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store
196 'xyz' , ## literal histogram identifier
197 'x vs y vs z' , ## histogram title
198 10 , ## number of X-bins
199 -1.0 , ## low X-edge
200 1.0 , ## high X-edge
201 10 , ## number of Y-bins
202 -1.0 , ## low Y-edge
203 1.0 , ## high Y-edge
204 10 , ## number of Z-bins
205 -1.0 , ## low Z-edge
206 1.0 ) ## high Z-edge
207
208 (9) book the trivial 3D histogram with directory path and integer ID
209
210 >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store
211 888 , ## integer histogram identifier
212 'x vs y vs z' , ## histogram title
213 10 , ## number of X-bins
214 -1.0 , ## low X-edge
215 1.0 , ## high X-edge
216 10 , ## number of Y-bins
217 -1.0 , ## low Y-edge
218 1.0 , ## high Y-edge
219 10 , ## number of Z-bins
220 -1.0 , ## low Z-edge
221 1.0 ) ## high Z-edge
222
223 Many other booking methods are available,
224 e.g. for the histograms with non-equidistant bins, see IHistogamSvc::book
225
226 """
227 if useROOT or kwargs.get('useROOT',
228 False) or not kwargs.get('useAIDA', True):
229 from ROOT import TH1D
230 a0 = args[0]
231 a1 = args[1]
232 a2 = args[2]
233 if not str is type(a1):
234 a1 = 'h' + str(a1)
235 if str is type(a2):
236 return TH1D(a0 + a1, a2, *args[3:])
237 else:
238 return TH1D(a0, a1, *args[2:])
239
240 svc = _getHistoSvc(**kwargs)
241 if not svc:
242 raise RuntimeError('Unable to get valid HistogramService ')
243 # book the histogram using the service
244 return svc.book(*args) # RETURN
245
246
247 book.__doc__ += '\n\n' + '\thelp(iHistogramSvc.book) : \n\n' \
248 + iHistogramSvc.book . __doc__
249 book.__doc__ += '\n\n' + '\thelp(IHistogramSvc::book) : \n\n' \
250 + cpp.IHistogramSvc.book . __doc__
251
252 # =============================================================================
253 # The trivial function to book 1D&2D profile histograms:
254
255
GaudiPython.HistoUtils._getHistoSvc
def _getHistoSvc(**kwargs)
Definition: HistoUtils.py:80
GaudiPython.HistoUtils.book
def book(*args, **kwargs)
Definition: HistoUtils.py:114
gaudirun.type
type
Definition: gaudirun.py:142

## ◆ bookProf()

def GaudiPython.HistoUtils.bookProf | ( | * | args,
|  | ** | kwargs
| ) |  |

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

256 def bookProf(*args, **kwargs):
257 """
258
259 The trivial function to book 1D&2D profile histograms:
260
261 (1) book 1D-profile histogram with full path in Histogram Transient Store:
262 >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store
263 'Energy Correction' , ## the histogram title
264 100 , ## number of X-bins
265 0.0 , ## low X-edge
266 100 ) ## high X-edge
267
268 (2) book 1D-profile histogram with directory path and literal ID
269 >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store
270 'Calibration' , ## the histogram literal identifier
271 'Energy Correction' , ## the histogram title
272 100 , ## number of X-bins
273 0.0 , ## low X-edge
274 100 ) ## high X-edge
275
276 (3) book 1D-profile histogram with directory path and integer ID
277 >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store
278 418 , ## the histogram integer identifier
279 'Energy Correction' , ## the histogram title
280 100 , ## number of X-bins
281 0.0 , ## low X-edge
282 100 ) ## high X-edge
283
284 (4) book 2D-profile histogram with full path in Histogram Transient Store:
285 >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store
286 'Energy Correction' , ## the histogram title
287 50 , ## number of X-bins
288 0.0 , ## low X-edge
289 100 , ## high X-edge
290 50 , ## number of Y-bins
291 0.0 , ## low Y-edge
292 100 ) ## high Y-edge
293
294 (5) book 2D-profile histogram with directory path and literal ID
295 >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store
296 'Calibration' , ## the histogram literal identifier
297 'Energy Correction' , ## the histogram title
298 50 , ## number of X-bins
299 0.0 , ## low X-edge
300 100 , ## high X-edge
301 50 , ## number of Y-bins
302 0.0 , ## low Y-edge
303 100 ) ## high Y-edge
304
305 (6) book 2D-profile histogram with directory path and integer ID
306 >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store
307 418 , ## the histogram integer identifier
308 'Energy Correction' , ## the histogram title
309 50 , ## number of X-bins
310 0.0 , ## low X-edge
311 100 , ## high X-edge
312 50 , ## number of Y-bins
313 0.0 , ## low Y-edge
314 100 ) ## high Y-edge
315
316 Many other booking methods are available,
317 e.g. for the histograms with non-equidistant bins, see IHistogamSvc::book
318
319 """
320 svc = _getHistoSvc(**kwargs)
321 if not svc:
322 raise RuntimeError('Unable to get valid HistogramService ')
323 # book the histogram using the service
324 return svc.bookProf(*args) # RETURN
325
326
327 bookProf.__doc__ += '\n\n' + '\thelp(iHistogramSvc.bookProf) : \n\n' \
328 + iHistogramSvc.bookProf . __doc__
329 bookProf.__doc__ += '\n\n' + '\thelp(IHistogramSvc::bookProf) : \n\n' \
330 + cpp.IHistogramSvc.bookProf . __doc__
331
332 # =============================================================================
333 # The most trivial function to retrieve the histogram from Histogram Transient Store
334
335
GaudiPython.HistoUtils._getHistoSvc
def _getHistoSvc(**kwargs)
Definition: HistoUtils.py:80
GaudiPython.HistoUtils.bookProf
def bookProf(*args, **kwargs)
Definition: HistoUtils.py:256

## ◆ fill()

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

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

383 def fill(
384 histo, # histogram
385 data, # input data
386 fun=lambda x: x, # function to be used
387 cut=lambda x: True, # cut to be applied
388 **kwargs): # optional extra arguments
389 """
390
391 The function which allows 'the smart fill' of 1D-histogram
392
393 >>> histo = ...
394
395 The most trivial case, fill with the value
396 >>> fill ( histo , 1.0 )
397
398 Fill from any iterable object (sequence)
399 >>> fill ( histo , [1,,2,3,4,5,10] )
400
401 Fill from iterable object and apply the function:
402 >>> fill ( histo , [1,2,3,4,5] , math.sin )
403
404 Use lambda form:
405 >>> fill ( histo , [1,2,3,4,5] , lambda x : x*x )
406
407 The same
408 >>> fill ( histo , [1,2,3,4,5] , fun = lambda x : x*x )
409
410 Use internal attributes:
411 >>> tracks = evtSvc['Rec/Track/Best'] ## iterable container of tracks
412 >>> fill ( histo , tracks , lambda t : t.pt() )
413
414 Apply the predicate: fill only even numbers:
415 >>> fill ( histo , [1,2,3,4,5,6,7] , lambda x : x , lambda y : y%2 )
416
417 The same (omit the trivial function) :
418 >>> fill ( histo , [1,2,3,4,5,6,7] , cut = lambda y : y%2 )
419
420 Apply the predicate: fill only pt for positively charged tracks:
421 >>> tracks = evtSvc['Rec/Track/Best']
422 >>> fill ( histo , tracks , lambda t : t.pt() , lambda t : 0<t.charge() )
423
424 The same:
425 >>> fill ( histo , tracks ,
426 fun = lambda t : t.pt() ,
427 cut = lambda t : 0<t.charge() )
428
429 Ordinary functions are also fine:
430 >>> def myfun ( track ) : return sin( track.pt() + track.p() )
431 >>> def mycut ( track ) : return track.p() > 100 * GeV
432 >>> fill ( histo , tracks , myfun , mycut )
433
434 The 'data' could be the address in TES, in this case the object
435 is retrieved from TES and the method is applied to the objects,
436 retrieved from TES:
437 >>> fill ( histo , ## the reference to the histogram
438 'Rec/Track/Best' , ## the location of objects in TES
439 lambda t : t.pt() ) ## function to be used for histogram fill
440 >>> fill ( histo , ## the reference to the histogram
441 'Rec/Track/Best' , ## the address of objects in TES
442 lambda t : t.pt() , ## the function to be used for histogram fill
443 lambda t : t.charge()>0 ) ## the criteria to select tracks
444
445 The arguments 'fun' and 'cut' could be strings, in this case
446 they are evaluated by python before usage.
447 This option could be often very useful.
448
449 """
450
451 # if value is a string, try to get the objects from TES
452 if type(data) == str:
453 svc = _getEvtSvc(**kwargs)
454 data = svc[data]
455 return fill(histo, data, fun, cut, **kwargs)
456
457 # if the function is a string: evaluate it!
458 if type(fun) == str:
459 fun = eval(fun, globals())
460
461 # if the criterion is a string: evaluate it!
462 if type(cut) == str:
463 cut = eval(cut, globals())
464
465 if not hasattr(data, '__iter__'):
466 data = [data]
467
468 if not hasattr(histo, 'fill') and hasattr(histo, 'Fill'):
469 setattr(histo, 'fill', getattr(histo, 'Fill'))
470
471 for item in data:
472 if not cut(item):
473 continue # CONTINUE
474 histo.fill(fun(item))
475
476 return histo # RETURN
477
478
479 # =============================================================================
480 # AIDA -> ROOT converter
gaudirun.type
type
Definition: gaudirun.py:142
GaudiPython.HistoUtils.fill
def fill(histo, data, fun=lambda x:x, cut=lambda x:True, **kwargs)
Definition: HistoUtils.py:383
GaudiPython.HistoUtils._getEvtSvc
def _getEvtSvc(**kwargs)
Definition: HistoUtils.py:97

## ◆ getAsAIDA()

def GaudiPython.HistoUtils.getAsAIDA | ( |  | path,
|  | ** | kwargs
| ) |  |

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

336 def getAsAIDA(path, **kwargs):
337 """
338
339 The most trivial function to retrieve the histogram from Histogram Transient Store
340 The histogram is returned by reference to its AIDA-representation (if possible)
341
342 >>> h = getAsAIDA ( 'some/path/to/my/histogram' )
343
344 """
345 svc = _getHistoSvc(**kwargs)
346 if not svc:
347 raise RuntimeError('Unable to get valid HistogramService ')
348 # return the histogram
349 return svc.getAsAIDA(path) # RETURN
350
351
352 getAsAIDA.__doc__ += '\n\n' + '\thelp(iHistogramSvc.getAsAIDA) : \n\n' \
353 + iHistogramSvc.getAsAIDA . __doc__
354 getAsAIDA.__doc__ += '\n\n' + '\thelp(iHistogramSvc.retrieve) : \n\n' \
355 + iHistogramSvc.retrieve . __doc__
356
357 # =============================================================================
358 # The most trivial function to retrieve the histogram from Histogram Transient Store
359
360
GaudiPython.HistoUtils._getHistoSvc
def _getHistoSvc(**kwargs)
Definition: HistoUtils.py:80
GaudiPython.HistoUtils.getAsAIDA
def getAsAIDA(path, **kwargs)
Definition: HistoUtils.py:336

## ◆ getAsROOT()

def GaudiPython.HistoUtils.getAsROOT | ( |  | path,
|  | ** | kwargs
| ) |  |

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

361 def getAsROOT(path, **kwargs):
362 """
363
364 The most trivial function to retrieve the histogram from Histogram Transient Store
365 The histogram is returned by reference to its underlying native ROOT-representation (if possible)
366
367 >>> h = getAsROOT ( 'some/path/to/my/histogram' )
368
369 """
370 svc = _getHistoSvc(**kwargs)
371 if not svc:
372 raise RuntimeError('Unable to get valid HistogramService ')
373 # return the histogram
374 return svc.getAsROOT(path) # RETURN
375
376
377 getAsROOT.__doc__ += '\n\n' + '\thelp(iHistogramSvc.getAsROOT) : \n\n' \
378 + iHistogramSvc.getAsROOT . __doc__
379
380
381 # =============================================================================
382 # The function which allows 'the smart fill' of 1D-histogram
GaudiPython.HistoUtils.getAsROOT
def getAsROOT(path, **kwargs)
Definition: HistoUtils.py:361
GaudiPython.HistoUtils._getHistoSvc
def _getHistoSvc(**kwargs)
Definition: HistoUtils.py:80

## Variable Documentation

## ◆ __all__

tuple GaudiPython.HistoUtils.__all__
| private

Initial value:
1 = (
2 'book', # book AIDA histogram using Histogram Service
3 'bookProf', # book AIDA profile histogram using Histogram Service
4 'getAsAIDA', # get the histogram form Histogram Service as AIDA histogram
5 'getAsROOT', # get the histogram form Histogram Service as AIDA histogram
6 'fill', # "power-fill" method for filling of histograms
7 'aida2root', # AIDA -> ROOT converter
8 'HistoStats', # statistical information for 1D-histograms
9 'HistoFile', # class for storing histograms to a file
10 'histoDump', # dump histogramintext format a'la HBOOK 'dumpHisto' # dump histogramintext format a'la HBOOK
11 )

Definition at line 29 of file HistoUtils.py.

## ◆ __author__

string GaudiPython.HistoUtils.__author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu"
| private

Definition at line 27 of file HistoUtils.py.

## ◆ __repr__

GaudiPython.HistoUtils.__repr__
| private

Definition at line 508 of file HistoUtils.py.

## ◆ __str__

GaudiPython.HistoUtils.__str__
| private

Definition at line 510 of file HistoUtils.py.

## ◆ aida2root

GaudiPython.HistoUtils.aida2root = cpp.Gaudi.Utils.Aida2ROOT.aida2root

Definition at line 481 of file HistoUtils.py.

## ◆ centralMoment

GaudiPython.HistoUtils.centralMoment

Definition at line 869 of file HistoUtils.py.

## ◆ centralMomentErr

GaudiPython.HistoUtils.centralMomentErr

Definition at line 871 of file HistoUtils.py.

## ◆ dumpHisto

def GaudiPython.HistoUtils.dumpHisto = __dumpHisto__

Definition at line 963 of file HistoUtils.py.

## ◆ HID

GaudiPython.HistoUtils.HID = cpp.GaudiAlg.ID

Definition at line 47 of file HistoUtils.py.

## ◆ histoDump

def GaudiPython.HistoUtils.histoDump = __dumpHisto__

Definition at line 962 of file HistoUtils.py.

## ◆ HistoStats

GaudiPython.HistoUtils.HistoStats = cpp.Gaudi.Utils.HistoStats

Definition at line 512 of file HistoUtils.py.

## ◆ i1DH

GaudiPython.HistoUtils.i1DH = cpp.AIDA.IHistogram1D

Definition at line 862 of file HistoUtils.py.

## ◆ iBH

GaudiPython.HistoUtils.iBH = cpp.AIDA.IBaseHistogram

Definition at line 930 of file HistoUtils.py.

## ◆ kurtosis

GaudiPython.HistoUtils.kurtosis

Definition at line 887 of file HistoUtils.py.

## ◆ kurtosisErr

GaudiPython.HistoUtils.kurtosisErr

Definition at line 889 of file HistoUtils.py.

## ◆ location

GaudiPython.HistoUtils.location

Definition at line 936 of file HistoUtils.py.

## ◆ mean

GaudiPython.HistoUtils.mean

Definition at line 875 of file HistoUtils.py.

## ◆ meanErr

GaudiPython.HistoUtils.meanErr

Definition at line 877 of file HistoUtils.py.

## ◆ moment

GaudiPython.HistoUtils.moment

Definition at line 865 of file HistoUtils.py.

## ◆ momentErr

GaudiPython.HistoUtils.momentErr

Definition at line 867 of file HistoUtils.py.

## ◆ nEff

GaudiPython.HistoUtils.nEff

Definition at line 873 of file HistoUtils.py.

## ◆ nEntries

GaudiPython.HistoUtils.nEntries

Definition at line 910 of file HistoUtils.py.

## ◆ nEntriesFrac

GaudiPython.HistoUtils.nEntriesFrac

Definition at line 912 of file HistoUtils.py.

## ◆ nEntriesFracErr

GaudiPython.HistoUtils.nEntriesFracErr

Definition at line 914 of file HistoUtils.py.

## ◆ overflowEntriesFrac

GaudiPython.HistoUtils.overflowEntriesFrac

Definition at line 892 of file HistoUtils.py.

## ◆ overflowEntriesFracErr

GaudiPython.HistoUtils.overflowEntriesFracErr

Definition at line 894 of file HistoUtils.py.

## ◆ overflowIntegralFrac

GaudiPython.HistoUtils.overflowIntegralFrac

Definition at line 901 of file HistoUtils.py.

## ◆ overflowIntegralFracErr

GaudiPython.HistoUtils.overflowIntegralFracErr

Definition at line 903 of file HistoUtils.py.

## ◆ path

GaudiPython.HistoUtils.path

Definition at line 932 of file HistoUtils.py.

## ◆ rms

GaudiPython.HistoUtils.rms

Definition at line 879 of file HistoUtils.py.

## ◆ rmsErr

GaudiPython.HistoUtils.rmsErr

Definition at line 881 of file HistoUtils.py.

## ◆ skewness

GaudiPython.HistoUtils.skewness

Definition at line 883 of file HistoUtils.py.

## ◆ skewnessErr

GaudiPython.HistoUtils.skewnessErr

Definition at line 885 of file HistoUtils.py.

## ◆ TESpath

GaudiPython.HistoUtils.TESpath

Definition at line 934 of file HistoUtils.py.

## ◆ underflowEntriesFrac

GaudiPython.HistoUtils.underflowEntriesFrac

Definition at line 896 of file HistoUtils.py.

## ◆ underflowEntriesFracErr

GaudiPython.HistoUtils.underflowEntriesFracErr

Definition at line 898 of file HistoUtils.py.

## ◆ underflowIntegralFrac

GaudiPython.HistoUtils.underflowIntegralFrac

Definition at line 905 of file HistoUtils.py.

## ◆ underflowIntegralFracErr

GaudiPython.HistoUtils.underflowIntegralFracErr

Definition at line 907 of file HistoUtils.py.

## ◆ useROOT

bool GaudiPython.HistoUtils.useROOT = False

global flag

Definition at line 50 of file HistoUtils.py.