| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

IHistoTool.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_IHISTOTOOL_H
2 #define GAUDIALG_IHISTOTOOL_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // from STL
7 // ============================================================================
8 #include <string>
9 // ============================================================================
10 // from Gaudi
11 // ============================================================================
12 #include "GaudiKernel/IAlgTool.h"
13 #include "GaudiAlg/HistoID.h"
14 // ============================================================================
15
16 namespace AIDA
17 {
18 class IHistogram1D;
19 class IHistogram2D;
20 class IHistogram3D;
21 }
22
31 class GAUDI_API IHistoTool: virtual public IAlgTool
32 {
33 public:
35 DeclareInterfaceID(IHistoTool,2,0);
36
38 typedef Histos::HistoID HistoID ;
39
40 public:
41
42 // ================================= 1D Histograms ========================================
43
72 virtual AIDA::IHistogram1D* plot1D
73 ( const double value ,
74 const std::string& title ,
75 const double low ,
76 const double high ,
77 const unsigned long bins = 100 ,
78 const double weight = 1.0 ) const = 0 ;
79
93 AIDA::IHistogram1D* plot
94 ( const double value ,
95 const std::string& title ,
96 const double low ,
97 const double high ,
98 const unsigned long bins = 100 ,
99 const double weight = 1.0 ) const
100 {
101 return plot1D ( value, title, low, high, bins, weight );
102 }
103
144 virtual AIDA::IHistogram1D* plot1D
145 ( const double value ,
146 const HistoID& ID ,
147 const std::string& title ,
148 const double low ,
149 const double high ,
150 const unsigned long bins = 100 ,
151 const double weight = 1.0 ) const = 0 ;
152
167 AIDA::IHistogram1D* plot
168 ( const double value ,
169 const HistoID& ID ,
170 const std::string& title ,
171 const double low ,
172 const double high ,
173 const unsigned long bins = 100 ,
174 const double weight = 1.0 ) const
175 {
176 return plot1D ( value, ID, title, low, high, bins, weight );
177 };
178
179 // ================================= 2D Histograms ========================================
180
215 virtual AIDA::IHistogram2D* plot2D
216 ( const double valueX ,
217 const double valueY ,
218 const std::string& title ,
219 const double lowX ,
220 const double highX ,
221 const double lowY ,
222 const double highY ,
223 const unsigned long binsX = 50 ,
224 const unsigned long binsY = 50 ,
225 const double weight = 1.0 ) const = 0;
226
273 virtual AIDA::IHistogram2D* plot2D
274 ( const double valueX ,
275 const double valueY ,
276 const HistoID& ID ,
277 const std::string& title ,
278 const double lowX ,
279 const double highX ,
280 const double lowY ,
281 const double highY ,
282 const unsigned long binsX = 50 ,
283 const unsigned long binsY = 50 ,
284 const double weight = 1.0 ) const = 0;
285
286 // ================================= 3D Histograms ========================================
287
328 virtual AIDA::IHistogram3D* plot3D
329 ( const double valueX ,
330 const double valueY ,
331 const double valueZ ,
332 const std::string& title ,
333 const double lowX ,
334 const double highX ,
335 const double lowY ,
336 const double highY ,
337 const double lowZ ,
338 const double highZ ,
339 const unsigned long binsX = 10 ,
340 const unsigned long binsY = 10 ,
341 const unsigned long binsZ = 10 ,
342 const double weight = 1.0 ) const = 0;
343
396 virtual AIDA::IHistogram3D* plot3D
397 ( const double valueX ,
398 const double valueY ,
399 const double valueZ ,
400 const HistoID& ID ,
401 const std::string& title ,
402 const double lowX ,
403 const double highX ,
404 const double lowY ,
405 const double highY ,
406 const double lowZ ,
407 const double highZ ,
408 const unsigned long binsX = 10 ,
409 const unsigned long binsY = 10 ,
410 const unsigned long binsZ = 10 ,
411 const double weight = 1.0 ) const = 0;
412
413 public:
414
426 virtual AIDA::IHistogram1D* book1D
427 ( const std::string& title ,
428 const double low = 0 ,
429 const double high = 100 ,
430 const unsigned long bins = 100 ) const = 0 ;
431
444 AIDA::IHistogram1D* book
445 ( const std::string& title ,
446 const double low = 0 ,
447 const double high = 100 ,
448 const unsigned long bins = 100 ) const
449 {
450 return book1D( title, low, high, bins );
451 }
452
467 virtual AIDA::IHistogram2D* book2D
468 ( const std::string& title ,
469 const double lowX = 0 ,
470 const double highX = 100 ,
471 const unsigned long binsX = 50 ,
472 const double lowY = 0 ,
473 const double highY = 100 ,
474 const unsigned long binsY = 50 ) const = 0;
475
493 virtual AIDA::IHistogram3D* book3D
494 ( const std::string& title ,
495 const double lowX = 0 ,
496 const double highX = 100 ,
497 const unsigned long binsX = 10 ,
498 const double lowY = 0 ,
499 const double highY = 100 ,
500 const unsigned long binsY = 10 ,
501 const double lowZ = 0 ,
502 const double highZ = 100 ,
503 const unsigned long binsZ = 10 ) const = 0;
504
515 virtual AIDA::IHistogram1D* book1D
516 ( const HistoID& ID ,
517 const std::string& title = "" ,
518 const double low = 0 ,
519 const double high = 100 ,
520 const unsigned long bins = 100 ) const = 0 ;
521
535 AIDA::IHistogram1D* book
536 ( const HistoID& ID ,
537 const std::string& title = "" ,
538 const double low = 0 ,
539 const double high = 100 ,
540 const unsigned long bins = 100 ) const
541 {
542 return book1D( ID, title, low, high, bins );
543 }
544
555 virtual AIDA::IHistogram2D* book2D
556 ( const HistoID& ID ,
557 const std::string& title ,
558 const double lowX = 0 ,
559 const double highX = 100 ,
560 const unsigned long binsX = 100 ,
561 const double lowY = 0 ,
562 const double highY = 100 ,
563 const unsigned long binsY = 100 ) const = 0;
564
581 virtual AIDA::IHistogram3D* book3D
582 ( const HistoID& ID ,
583 const std::string& title ,
584 const double lowX = 0 ,
585 const double highX = 100 ,
586 const unsigned long binsX = 10 ,
587 const double lowY = 0 ,
588 const double highY = 100 ,
589 const unsigned long binsY = 10 ,
590 const double lowZ = 0 ,
591 const double highZ = 100 ,
592 const unsigned long binsZ = 10 ) const = 0;
593
601 virtual AIDA::IHistogram1D* fill
602 ( AIDA::IHistogram1D* histo ,
603 const double value ,
604 const double weight ,
605 const std::string& title = "") const = 0 ;
606
615 virtual AIDA::IHistogram2D* fill
616 ( AIDA::IHistogram2D* histo ,
617 const double valueX ,
618 const double valueY ,
619 const double weight ,
620 const std::string& title = "" ) const = 0 ;
621
631 virtual AIDA::IHistogram3D* fill
632 ( AIDA::IHistogram3D* histo ,
633 const double valueX ,
634 const double valueY ,
635 const double valueZ ,
636 const double weight ,
637 const std::string& title = "" ) const = 0 ;
638
642 virtual AIDA::IHistogram1D* histo1D ( const std::string& title ) const = 0 ;
643
651 AIDA::IHistogram1D* histo ( const std::string& title ) const
652 {
653 return histo1D( title );
654 };
655
659 virtual AIDA::IHistogram2D* histo2D ( const std::string& title ) const = 0;
660
661
665 virtual AIDA::IHistogram3D* histo3D ( const std::string& title ) const = 0;
666
670 virtual AIDA::IHistogram1D* histo1D ( const HistoID& ID ) const = 0 ;
671
679 AIDA::IHistogram1D* histo ( const HistoID& ID ) const
680 {
681 return histo1D( ID );
682 };
683
687 virtual AIDA::IHistogram2D* histo2D ( const HistoID& ID ) const = 0;
688
692 virtual AIDA::IHistogram3D* histo3D ( const HistoID& ID ) const = 0;
693
695 virtual bool histoExists ( const std::string& title ) const = 0 ;
696
698 virtual bool histoExists ( const HistoID& ID ) const = 0 ;
699
700 public: // non-virtual methods
701
751 template <class FUNCTION,class OBJECT>
752 AIDA::IHistogram1D* plot
753 ( const FUNCTION& func ,
754 OBJECT first ,
755 OBJECT last ,
756 const std::string& title ,
757 const double low ,
758 const double high ,
759 const unsigned long bins = 100 ) const
760 {
761 // retrieve or book the histogram
762 AIDA::IHistogram1D* h = histo1D ( title ) ;
763 if ( !h ) { h = book1D ( title , low , high , bins ); }
764 while ( first != last && h )
765 { h = fill ( h , func( *first ) , 1.0 , title ) ; ++first ; }
766 return h ;
767 }
768
818 template <class FUNCTION,class OBJECT>
819 AIDA::IHistogram1D* plot
820 ( const FUNCTION& func ,
821 OBJECT first ,
822 OBJECT last ,
823 const HistoID& ID ,
824 const std::string& title ,
825 const double low ,
826 const double high ,
827 const unsigned long bins = 100 ) const
828 {
829 // retrieve or book the histogram
830 AIDA::IHistogram1D* h = histo1D ( ID ) ;
831 if ( !h ) { h = book1D ( ID , title , low , high , bins ); }
832 while ( first != last && h )
833 { h = fill( h , func( *first ) , 1.0 , title ) ; ++first ; }
834 return h ;
835 }
836
891 template <class FUNCTION,class OBJECT,class WEIGHT>
892 AIDA::IHistogram1D* plot
893 ( const FUNCTION& func ,
894 OBJECT first ,
895 OBJECT last ,
896 const std::string& title ,
897 const double low ,
898 const double high ,
899 const unsigned long bins ,
900 const WEIGHT& weight ) const
901 {
902 // retrieve or book the histogram
903 AIDA::IHistogram1D* h = histo1D ( title ) ;
904 if ( !h ) { h = book1D ( title , low , high , bins ); }
905 while( first != last && h )
906 { h = fill ( h ,
907 func ( *first ) ,
908 weight ( *first ) , title ) ; ++first ; }
909 return h ;
910 }
911
971 template <class FUNCTION,class OBJECT,class WEIGHT>
972 AIDA::IHistogram1D* plot
973 ( const FUNCTION& func ,
974 OBJECT first ,
975 OBJECT last ,
976 const HistoID& ID ,
977 const std::string& title ,
978 const double low ,
979 const double high ,
980 const unsigned long bins ,
981 const WEIGHT& weight ) const
982 {
983 // retrieve or book the histogram
984 AIDA::IHistogram1D* h = histo1D ( ID ) ;
985 if ( !h ) { h = book1D ( ID , title , low , high , bins ); }
986 while( first != last && h )
987 { h = fill ( h ,
988 func ( *first ) ,
989 weight ( *first ) , title ) ; ++first ; }
990 return h ;
991 }
992
993 protected:
994
995 ~IHistoTool() override = default;
996
997 };
998
999 #endif // GAUDIALG_IHISTOTOOL_H
Gaudi::Histos::book
GAUDI_API AIDA::IHistogram1D * book(IHistogramSvc *svc, const std::string &path, const Gaudi::Histo1DDef &hist)
helper function to book 1D-histogram
Definition: HistoDef.cpp:124
IHistoTool::histo
AIDA::IHistogram1D * histo(const HistoID &ID) const
access the EXISTING 1D histogram by ID
Definition: IHistoTool.h:679
DeclareInterfaceID
#define DeclareInterfaceID(iface, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:14
IHistoTool::histo
AIDA::IHistogram1D * histo(const std::string &title) const
access the EXISTING 1D histogram by title
Definition: IHistoTool.h:651
Gaudi::Utils::Histos::fill
GAUDI_API void fill(AIDA::IHistogram1D *histo, const double value, const double weight=1.0)
simple function to fill AIDA::IHistogram1D objects
Definition: Fill.cpp:36
GaudiPython.Pythonizations.plot
plot
Definition: Pythonizations.py:83
AIDA
GaudiKernel.
Definition: Fill.h:8
std::string
STL class.
HistoID.h
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:218
HiveAlgSequencer.h
h
Definition: HiveAlgSequencer.py:24
IAlgTool.h
IHistoTool::HistoID
Histos::HistoID HistoID
the actual type for histogram identifier (HBOOK style)
Definition: IHistoTool.h:38
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
GaudiAlg::ID
ID class for Histogram and Ntuples.
Definition: GaudiHistoID.h:44
IHistoTool
An abstract interface for "histogramming tool".
Definition: IHistoTool.h:31