| The Gaudi Framework v30r0 (c919700c)

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

- File List
- File Members

GaudiHistos.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_GAUDIHISTOS_H
2 #define GAUDIALG_GAUDIHISTOS_H 1
3 // ============================================================================
4 /* @file GaudiHistos.h
5 *
6 * Header file for class : GaudiHistos
7 *
8 * @author Chris Jones Christopher.Rob.Jones@cern.ch
9 * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
10 * @date 2005-08-08
11 */
12 // ============================================================================
13 // Include files#
14 // ============================================================================
15 // STD& STL
16 // ============================================================================
17 #include <boost/algorithm/string/replace.hpp>
18 #include <limits>
19 #include <type_traits>
20 #include <vector>
21 // ============================================================================
22 // GaudiKernel
23 // ============================================================================
24 #include "GaudiKernel/HistoProperty.h"
25 // ============================================================================
26 // GaudiUtils
27 // ============================================================================
28 #include "GaudiUtils/HistoTableFormat.h"
29 // ============================================================================
30 // GaudiAlg
31 // ============================================================================
32 #include "GaudiAlg/GaudiAlgorithm.h"
33 #include "GaudiAlg/GaudiTool.h"
34 #include "GaudiAlg/Maps.h"
35 // ============================================================================
36 // Forward declarations
37 namespace AIDA
38 {
39 class IHistogram1D;
40 class IHistogram2D;
41 class IHistogram3D;
42 class IProfile1D;
43 class IProfile2D;
44 }
45 // ============================================================================
55 template <class PBASE>
56 class GAUDI_API GaudiHistos : public PBASE
57 {
58 public:
59 // ==========================================================================
61 typedef GaudiAlg::HistoID HistoID;
62 // ==========================================================================
64 typedef GaudiAlg::Histo1DMapID Histo1DMapID;
66 typedef GaudiAlg::Histo1DMapTitle Histo1DMapTitle;
67 // ==========================================================================
69 typedef GaudiAlg::Histo2DMapID Histo2DMapID;
71 typedef GaudiAlg::Histo2DMapTitle Histo2DMapTitle;
72 // ==========================================================================
74 typedef GaudiAlg::Histo3DMapID Histo3DMapID;
76 typedef GaudiAlg::Histo3DMapTitle Histo3DMapTitle;
77 // ==========================================================================
79 typedef GaudiAlg::Profile1DMapID Profile1DMapID;
81 typedef GaudiAlg::Profile1DMapTitle Profile1DMapTitle;
82 // ==========================================================================
84 typedef GaudiAlg::Profile2DMapID Profile2DMapID;
86 typedef GaudiAlg::Profile2DMapTitle Profile2DMapTitle;
87 // ==========================================================================
89 typedef GaudiAlg::HistoBinEdges HistoBinEdges;
90 // ==========================================================================
91 public:
92 // ==========================================================================
93 // ================================= 1D Histograms ==========================
94 // ================================= Fixed Binning ==========================
95 // ==========================================================================
138 AIDA::IHistogram1D* plot1D( const double value, const std::string& title, const double low, const double high,
139 const unsigned long bins = 100, const double weight = 1.0 ) const;
140 // ==========================================================================
154 inline AIDA::IHistogram1D* plot( const double value, const std::string& title, const double low, const double high,
155 const unsigned long bins = 100, const double weight = 1.0 ) const
156 {
157 return plot1D( value, title, low, high, bins, weight );
158 }
159 // ==========================================================================
184 AIDA::IHistogram1D* plot1D( const double value, const Gaudi::Histo1DDef& hdef, const double weight = 1.0 ) const;
185 // ==========================================================================
196 inline AIDA::IHistogram1D* plot( const double value, const Gaudi::Histo1DDef& hdef, const double weight = 1.0 ) const
197 {
198 return plot1D( value, hdef, weight );
199 }
200 // ==========================================================================
265 // ==========================================================================
266 AIDA::IHistogram1D* plot1D( const double value, const HistoID& ID, const std::string& title, const double low,
267 const double high, const unsigned long bins = 100, const double weight = 1.0 ) const;
268 // ==========================================================================
283 inline AIDA::IHistogram1D* plot( const double value, const HistoID& ID, const std::string& title, const double low,
284 const double high, const unsigned long bins = 100, const double weight = 1.0 ) const
285 {
286 return plot1D( value, ID, title, low, high, bins, weight );
287 }
288 // ==========================================================================
314 AIDA::IHistogram1D* plot1D( const double value, const HistoID& ID, const Gaudi::Histo1DDef& hdef,
315 const double weight = 1.0 ) const;
316 // ==========================================================================
328 inline AIDA::IHistogram1D* plot( const double value, const HistoID& ID, const Gaudi::Histo1DDef& hdef,
329 const double weight = 1.0 ) const
330 {
331 return plot1D( value, ID, hdef, weight );
332 }
396 template <class FUNCTION, class OBJECT>
397 inline AIDA::IHistogram1D* plot( const FUNCTION& func, OBJECT first, OBJECT last, const std::string& title,
398 const double low, const double high, const unsigned long bins = 100 ) const
399 {
400 AIDA::IHistogram1D* h = nullptr;
401 if ( produceHistos() ) {
402 // retrieve or book the histogram
403 h = histo1D( title );
404 if ( !h ) {
405 h = book1D( title, low, high, bins );
406 }
407 // fill histogram
408 while ( first != last && h ) {
409 h = fill( h, func( *first ), 1.0, title );
410 ++first;
411 }
412 }
413 return h;
414 }
415 // ==========================================================================
471 template <class FUNCTION, class OBJECT>
472 inline AIDA::IHistogram1D* plot( const FUNCTION& func, OBJECT first, OBJECT last, const HistoID& ID,
473 const std::string& title, const double low, const double high,
474 const unsigned long bins = 100 ) const
475 {
476 AIDA::IHistogram1D* h( 0 );
477 if ( produceHistos() ) {
478 // retrieve or book the histogram
479 h = histo1D( ID );
480 if ( !h ) {
481 h = book1D( ID, title, low, high, bins );
482 }
483 // fill histogram
484 while ( first != last && h ) {
485 h = fill( h, func( *first ), 1.0, title );
486 ++first;
487 }
488 }
489 return h;
490 }
491 // ==========================================================================
560 template <class FUNCTION, class OBJECT, class WEIGHT>
561 inline AIDA::IHistogram1D* plot( const FUNCTION& func, OBJECT first, OBJECT last, const std::string& title,
562 const double low, const double high, const unsigned long bins,
563 const WEIGHT& weight ) const
564 {
565 AIDA::IHistogram1D* h = nullptr;
566 if ( produceHistos() ) {
567 // retrieve or book the histogram
568 h = histo1D( title );
569 if ( !h ) {
570 h = book1D( title, low, high, bins );
571 }
572 // fill histogram
573 while ( first != last && h ) {
574 h = fill( h, func( *first ), weight( *first ), title );
575 ++first;
576 }
577 }
578 return h;
579 }
580 // ==========================================================================
647 template <class FUNCTION, class OBJECT, class WEIGHT>
648 inline AIDA::IHistogram1D* plot( const FUNCTION& func, OBJECT first, OBJECT last, const HistoID& ID,
649 const std::string& title, const double low, const double high,
650 const unsigned long bins, const WEIGHT& weight ) const
651 {
652 AIDA::IHistogram1D* h = nullptr;
653 if ( produceHistos() ) {
654 // retrieve or book the histogram
655 h = histo1D( ID );
656 if ( !h ) {
657 h = book1D( ID, title, low, high, bins );
658 }
659 // fill histogram
660 while ( first != last && h ) {
661 h = fill( h, func( *first ), weight( *first ), title );
662 ++first;
663 }
664 }
665 return h;
666 }
667 // ==========================================================================
668 // ================================= 1D Histograms ==========================
669 // =============================== Variable Binning =========================
670 // ==========================================================================
710 AIDA::IHistogram1D* plot1D( const double value, const std::string& title, const HistoBinEdges& edges,
711 const double weight = 1.0 ) const;
712 // ==========================================================================
776 // ==========================================================================
777 AIDA::IHistogram1D* plot1D( const double value, const HistoID& ID, const std::string& title,
778 const HistoBinEdges& edges, const double weight = 1.0 ) const;
779 // ==========================================================================
780 // ================================= 2D Histograms ==========================
781 // ==========================================================================
832 AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const std::string& title, const double lowX,
833 const double highX, const double lowY, const double highY, const unsigned long binsX = 50,
834 const unsigned long binsY = 50, const double weight = 1.0 ) const;
835 // ==========================================================================
912 AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
913 const double lowX, const double highX, const double lowY, const double highY,
914 const unsigned long binsX = 50, const unsigned long binsY = 50,
915 const double weight = 1.0 ) const;
916 // ==========================================================================
917 // ================================= 2D Histograms ==========================
918 // =============================== Variable Binning =========================
919 // ==========================================================================
965 AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const std::string& title,
966 const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
967 const double weight = 1.0 ) const;
968 // ==========================================================================
1044 AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
1045 const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
1046 const double weight = 1.0 ) const;
1047 // ==========================================================================
1048 // ================================= 3D Histograms ==========================
1049 // ==========================================================================
1108 AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const std::string& title,
1109 const double lowX, const double highX, const double lowY, const double highY,
1110 const double lowZ, const double highZ, const unsigned long binsX = 10,
1111 const unsigned long binsY = 10, const unsigned long binsZ = 10,
1112 const double weight = 1.0 ) const;
1113 // ==========================================================================
1200 AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
1201 const std::string& title, const double lowX, const double highX, const double lowY,
1202 const double highY, const double lowZ, const double highZ, const unsigned long binsX = 10,
1203 const unsigned long binsY = 10, const unsigned long binsZ = 10,
1204 const double weight = 1.0 ) const;
1205 // ==========================================================================
1206 // ================================= 3D Histograms ==========================
1207 // =============================== Variable Binning =========================
1208 // ==========================================================================
1256 AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const std::string& title,
1257 const HistoBinEdges& edgesX, const HistoBinEdges& edgesY, const HistoBinEdges& edgesZ,
1258 const double weight = 1.0 ) const;
1259 // ==========================================================================
1260 // ==========================================================================
1345 AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
1346 const std::string& title, const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
1347 const HistoBinEdges& edgesZ, const double weight = 1.0 ) const;
1348 // ==========================================================================
1349 // ================================= 1D Profile =============================
1350 // ================================= Fixed binning ==========================
1351 // ==========================================================================
1400 AIDA::IProfile1D* profile1D( const double valueX, const double valueY, const std::string& title, const double lowX,
1401 const double highX, const unsigned long binsX = 100, const std::string& opt = "",
1402 const double lowY = -std::numeric_limits<double>::max(),
1403 const double highY = std::numeric_limits<double>::max(),
1404 const double weight = 1.0 ) const;
1405 // ==========================================================================
1471 AIDA::IProfile1D* profile1D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
1472 const double lowX, const double highX, const unsigned long binsX = 100,
1473 const std::string& opt = "", const double lowY = -std::numeric_limits<double>::max(),
1474 const double highY = std::numeric_limits<double>::max(),
1475 const double weight = 1.0 ) const;
1476 // ==========================================================================
1477 // ================================= 1D Profile =============================
1478 // ============================== Variable binning ==========================
1479 // ==========================================================================
1522 AIDA::IProfile1D* profile1D( const double valueX, const double valueY, const std::string& title,
1523 const HistoBinEdges& edges, const double weight = 1.0 ) const;
1524 // ==========================================================================
1586 AIDA::IProfile1D* profile1D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
1587 const HistoBinEdges& edges, const double weight = 1.0 ) const;
1588 // ==========================================================================
1589 // ================================= 2D Profile =============================
1590 // ==========================================================================
1641 AIDA::IProfile2D* profile2D( const double valueX, const double valueY, const double valueZ, const std::string& title,
1642 const double lowX, const double highX, const double lowY, const double highY,
1643 const unsigned long binsX = 50, const unsigned long binsY = 50,
1644 const double weight = 1.0 ) const;
1645 // ==========================================================================
1713 AIDA::IProfile2D* profile2D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
1714 const std::string& title, const double lowX, const double highX, const double lowY,
1715 const double highY, const unsigned long binsX = 50, const unsigned long binsY = 50,
1716 const double weight = 1.0 ) const;
1717 // ==========================================================================
1718 // ================================= 2D Profile =============================
1719 // ============================== Variable binning ==========================
1720 // ==========================================================================
1766 AIDA::IProfile2D* profile2D( const double valueX, const double valueY, const double valueZ, const std::string& title,
1767 const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
1768 const double weight = 1.0 ) const;
1769 // ==========================================================================
1832 AIDA::IProfile2D* profile2D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
1833 const std::string& title, const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
1834 const double weight = 1.0 ) const;
1835 // ==========================================================================
1836
1837 public: // 1D Fixed
1838 // ==========================================================================
1850 AIDA::IHistogram1D* book1D( const std::string& title, const double low = 0, const double high = 100,
1851 const unsigned long bins = 100 ) const;
1852 // ==========================================================================
1865 inline AIDA::IHistogram1D* book( const std::string& title, const double low = 0, const double high = 100,
1866 const unsigned long bins = 100 ) const
1867 {
1868 return book1D( title, low, high, bins );
1869 }
1870 // ==========================================================================
1879 AIDA::IHistogram1D* book( const Gaudi::Histo1DDef& hdef ) const;
1880 // ==========================================================================
1891 AIDA::IHistogram1D* book1D( const HistoID& ID, const std::string& title, const double low = 0,
1892 const double high = 100, const unsigned long bins = 100 ) const;
1893 // ==========================================================================
1907 inline AIDA::IHistogram1D* book( const HistoID& ID, const std::string& title, const double low = 0,
1908 const double high = 100, const unsigned long bins = 100 ) const
1909 {
1910 return book1D( ID, title, low, high, bins );
1911 }
1912 // ==========================================================================
1920 inline AIDA::IHistogram1D* book( const HistoID& ID, const Gaudi::Histo1DDef& hdef ) const;
1921 // ==========================================================================
1922
1923 public: // 1D Variable
1924 // ==========================================================================
1935 AIDA::IHistogram1D* book1D( const std::string& title, const HistoBinEdges& edges ) const;
1936 // ==========================================================================
1946 AIDA::IHistogram1D* book1D( const HistoID& ID, const std::string& title, const HistoBinEdges& edges ) const;
1947 // ==========================================================================
1948
1949 public: // 2D Fixed
1950 // ==========================================================================
1965 AIDA::IHistogram2D* book2D( const std::string& title, const double lowX = 0, const double highX = 100,
1966 const unsigned long binsX = 50, const double lowY = 0, const double highY = 100,
1967 const unsigned long binsY = 50 ) const;
1968 // ==========================================================================
1979 AIDA::IHistogram2D* book2D( const HistoID& ID, const std::string& title, const double lowX = 0,
1980 const double highX = 100, const unsigned long binsX = 50, const double lowY = 0,
1981 const double highY = 100, const unsigned long binsY = 50 ) const;
1982 // ==========================================================================
1983
1984 public: // 2D Variable
1985 // ==========================================================================
1997 AIDA::IHistogram2D* book2D( const std::string& title, const HistoBinEdges& edgesX,
1998 const HistoBinEdges& edgesY ) const;
1999 // ==========================================================================
2010 AIDA::IHistogram2D* book2D( const HistoID& ID, const std::string& title, const HistoBinEdges& edgesX,
2011 const HistoBinEdges& edgesY ) const;
2012 // ==========================================================================
2013
2014 public: // 3D Fixed
2015 // ==========================================================================
2033 AIDA::IHistogram3D* book3D( const std::string& title, const double lowX = 0, const double highX = 100,
2034 const unsigned long binsX = 10, const double lowY = 0, const double highY = 100,
2035 const unsigned long binsY = 10, const double lowZ = 0, const double highZ = 100,
2036 const unsigned long binsZ = 10 ) const;
2037 // ==========================================================================
2054 AIDA::IHistogram3D* book3D( const HistoID& ID, const std::string& title, const double lowX = 0,
2055 const double highX = 100, const unsigned long binsX = 10, const double lowY = 0,
2056 const double highY = 100, const unsigned long binsY = 10, const double lowZ = 0,
2057 const double highZ = 100, const unsigned long binsZ = 10 ) const;
2058 // ==========================================================================
2059
2060 public: // 3D Variable
2061 // ==========================================================================
2074 AIDA::IHistogram3D* book3D( const std::string& title, const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
2075 const HistoBinEdges& edgesZ ) const;
2076 // ==========================================================================
2088 AIDA::IHistogram3D* book3D( const HistoID& ID, const std::string& title, const HistoBinEdges& edgesX,
2089 const HistoBinEdges& edgesY, const HistoBinEdges& edgesZ ) const;
2090 // ==========================================================================
2091
2092 public: // 1D Fixed Profiles
2093 // ==========================================================================
2108 AIDA::IProfile1D* bookProfile1D( const std::string& title, const double low = 0, const double high = 100,
2109 const unsigned long bins = 100, const std::string& opt = "",
2110 const double lowY = -std::numeric_limits<double>::max(),
2111 const double highY = std::numeric_limits<double>::max() ) const;
2112 // ==========================================================================
2128 AIDA::IProfile1D* bookProfile1D( const HistoID& ID, const std::string& title, const double low = 0,
2129 const double high = 100, const unsigned long bins = 100, const std::string& opt = "",
2130 const double lowY = -std::numeric_limits<double>::max(),
2131 const double highY = std::numeric_limits<double>::max() ) const;
2132 // ==========================================================================
2133
2134 public: // 1D Variable Profiles
2135 // ==========================================================================
2145 AIDA::IProfile1D* bookProfile1D( const std::string& title, const HistoBinEdges& edges ) const;
2146 // ==========================================================================
2156 AIDA::IProfile1D* bookProfile1D( const HistoID& ID, const std::string& title, const HistoBinEdges& edges ) const;
2157 // ==========================================================================
2158
2159 public: // 2D Profiles
2160 // ==========================================================================
2175 AIDA::IProfile2D* bookProfile2D( const std::string& title, const double lowX = 0, const double highX = 100,
2176 const unsigned long binsX = 50, const double lowY = 0, const double highY = 100,
2177 const unsigned long binsY = 50 ) const;
2178 // ==========================================================================
2192 AIDA::IProfile2D* bookProfile2D( const HistoID& ID, const std::string& title, const double lowX = 0,
2193 const double highX = 100, const unsigned long binsX = 50, const double lowY = 0,
2194 const double highY = 100, const unsigned long binsY = 50 ) const;
2195 // ==========================================================================
2196
2197 public: // 2D Profiles
2198 // ==========================================================================
2209 AIDA::IProfile2D* bookProfile2D( const std::string& title, const HistoBinEdges& edgesX,
2210 const HistoBinEdges& edgesY ) const;
2211 // ==========================================================================
2221 AIDA::IProfile2D* bookProfile2D( const HistoID& ID, const std::string& title, const HistoBinEdges& edgesX,
2222 const HistoBinEdges& edgesY ) const;
2223 // ==========================================================================
2224
2225 public:
2226 // ==========================================================================
2234 AIDA::IHistogram1D* fill( AIDA::IHistogram1D* histo, const double value, const double weight,
2235 const std::string& title = "" ) const;
2236 // ==========================================================================
2245 AIDA::IHistogram2D* fill( AIDA::IHistogram2D* histo, const double valueX, const double valueY, const double weight,
2246 const std::string& title = "" ) const;
2247 // ==========================================================================
2257 AIDA::IHistogram3D* fill( AIDA::IHistogram3D* histo, const double valueX, const double valueY, const double valueZ,
2258 const double weight, const std::string& title = "" ) const;
2259 // ==========================================================================
2268 AIDA::IProfile1D* fill( AIDA::IProfile1D* histo, const double valueX, const double valueY, const double weight,
2269 const std::string& title = "" ) const;
2270 // ==========================================================================
2280 AIDA::IProfile2D* fill( AIDA::IProfile2D* histo, const double valueX, const double valueY, const double valueZ,
2281 const double weight, const std::string& title = "" ) const;
2282 // ==========================================================================
2283 public:
2284 // ==========================================================================
2288 inline AIDA::IHistogram1D* histo1D( const std::string& title ) const
2289 {
2290 auto found = histo1DMapTitle().find( title );
2291 return found != histo1DMapTitle().end() ? found->second : nullptr;
2292 }
2293 // ==========================================================================
2301 inline AIDA::IHistogram1D* histo( const std::string& title ) const { return histo1D( title ); }
2302 // ==========================================================================
2306 inline AIDA::IHistogram2D* histo2D( const std::string& title ) const
2307 {
2308 auto found = histo2DMapTitle().find( title );
2309 return histo2DMapTitle().end() != found ? found->second : nullptr;
2310 }
2311 // ==========================================================================
2315 inline AIDA::IHistogram3D* histo3D( const std::string& title ) const
2316 {
2317 auto found = histo3DMapTitle().find( title );
2318 return histo3DMapTitle().end() != found ? found->second : nullptr;
2319 }
2320 // ==========================================================================
2324 inline AIDA::IProfile1D* profile1D( const std::string& title ) const
2325 {
2326 auto found = profile1DMapTitle().find( title );
2327 return profile1DMapTitle().end() != found ? found->second : nullptr;
2328 }
2329 // ==========================================================================
2333 inline AIDA::IProfile2D* profile2D( const std::string& title ) const
2334 {
2335 auto found = profile2DMapTitle().find( title );
2336 return profile2DMapTitle().end() != found ? found->second : nullptr;
2337 }
2338 // ==========================================================================
2339 public:
2340 // ==========================================================================
2344 AIDA::IHistogram1D* histo1D( const HistoID& ID ) const;
2345 // ==========================================================================
2353 inline AIDA::IHistogram1D* histo( const HistoID& ID ) const { return histo1D( ID ); }
2354 // ==========================================================================
2358 AIDA::IHistogram2D* histo2D( const HistoID& ID ) const;
2359 // ==========================================================================
2363 AIDA::IHistogram3D* histo3D( const HistoID& ID ) const;
2364 // ==========================================================================
2368 AIDA::IProfile1D* profile1D( const HistoID& ID ) const;
2369 // ==========================================================================
2373 AIDA::IProfile2D* profile2D( const HistoID& ID ) const;
2374 // ==========================================================================
2375 public:
2376 // ==========================================================================
2378 inline bool histoExists( const std::string& title ) const
2379 {
2380 return ( 0 != histo( title ) || 0 != histo2D( title ) || 0 != histo3D( title ) || 0 != profile1D( title ) ||
2381 0 != profile2D( title ) );
2382 }
2383 // ==========================================================================
2385 inline bool histoExists( const HistoID& ID ) const
2386 {
2387 return ( 0 != histo( ID ) || 0 != histo2D( ID ) || 0 != histo3D( ID ) || 0 != profile1D( ID ) ||
2388 0 != profile2D( ID ) );
2389 }
2391 unsigned int totalNumberOfHistos() const;
2392 // ==========================================================================
2393 public: // trivial & non-trivial accessors
2394 // ==========================================================================
2396 inline bool produceHistos() const { return m_produceHistos; }
2398 inline bool fullDetail() const { return m_fullDetail; }
2400 inline bool checkForNaN() const { return m_checkForNaN; }
2402 inline bool splitHistoDir() const { return m_splitHistoDir; }
2404 inline HistoID::NumericID histoOffSet() const { return m_histoOffSet; }
2406 inline const std::string& histoTopDir() const { return m_histoTopDir; }
2408 inline const std::string& histoDir() const { return m_histoDir; }
2410 std::string histoPath() const;
2412 inline bool histosPrint() const { return m_histosPrint; }
2414 inline bool histoCountersPrint() const { return m_histoCountersPrint; }
2416 inline bool useNumericAutoIDs() const { return m_useNumericAutoIDs; }
2417 // ==========================================================================
2422 int printHistos( const MSG::Level level = MSG::ALWAYS ) const;
2423 // ==========================================================================
2449 const Histo1DMapTitle& histo1DMapTitle() const { return m_histo1DMapTitle; }
2450 // ==========================================================================
2473 const Histo1DMapID& histo1DMapID() const { return m_histo1DMapID; }
2474 // ==========================================================================
2500 const Histo2DMapTitle& histo2DMapTitle() const { return m_histo2DMapTitle; }
2501 // ==========================================================================
2523 const Histo2DMapID& histo2DMapID() const { return m_histo2DMapID; }
2524 // ==========================================================================
2550 const Histo3DMapTitle& histo3DMapTitle() const { return m_histo3DMapTitle; }
2551 // ==========================================================================
2573 const Histo3DMapID& histo3DMapID() const { return m_histo3DMapID; }
2574 // ==========================================================================
2602 const Profile1DMapTitle& profile1DMapTitle() const { return m_profile1DMapTitle; }
2603 // ==========================================================================
2625 const Profile1DMapID& profile1DMapID() const { return m_profile1DMapID; }
2626 // ==========================================================================
2652 const Profile2DMapTitle& profile2DMapTitle() const { return m_profile2DMapTitle; }
2653 // ==========================================================================
2675 const Profile2DMapID& profile2DMapID() const { return m_profile2DMapID; }
2676 // ==========================================================================
2677 public: // trivial setters
2678 // ==========================================================================
2680 inline void setProduceHistos( const bool val ) { m_produceHistos = val; }
2682 inline void setFullDetail( const bool val ) { m_fullDetail = val; }
2684 inline void setCheckForNaN( const bool val ) { m_checkForNaN = val; }
2686 inline void setSplitHistoDir( const bool val ) { m_splitHistoDir = val; }
2688 inline void setHistoOffSet( const HistoID::NumericID val ) { m_histoOffSet = val; }
2689 // ==========================================================================
2691 inline void setHistoTopDir( const std::string& val ) { m_histoTopDir = val; }
2692 // ==========================================================================
2694 inline void setHistoDir( const std::string& val ) { m_histoDir = val; }
2695 // ==========================================================================
2696 public:
2697 // ==========================================================================
2700 template <typename U = PBASE, typename = std::enable_if_t<std::is_base_of<GaudiAlgorithm, PBASE>::value, U>>
2701 GaudiHistos( const std::string& name, ISvcLocator* pSvcLocator ) : PBASE( name, pSvcLocator )
2702 {
2703 initGaudiHistosConstructor();
2704 }
2705 // ==========================================================================
2708 template <typename U = PBASE, typename = std::enable_if_t<std::is_base_of<GaudiTool, PBASE>::value, U>>
2709 GaudiHistos( const std::string& type, const std::string& name, const IInterface* parent )
2710 : PBASE( type, name, parent )
2711 {
2712 initGaudiHistosConstructor();
2713 }
2714 // ==========================================================================
2715 protected:
2716 // ==========================================================================
2720 StatusCode initialize() override
2721 #ifdef __ICC
2722 {
2723 return i_ghInitialize();
2724 }
2725 StatusCode i_ghInitialize()
2726 #endif
2727 ;
2728 // ==========================================================================
2732 StatusCode finalize() override
2733 #ifdef __ICC
2734 {
2735 return i_ghFinalize();
2736 }
2737 StatusCode i_ghFinalize()
2738 #endif
2739 ;
2740 // ==========================================================================
2741 private:
2742 // ==========================================================================
2744 bool noHistos() const;
2745 // ===========================================unsigned===============================
2747 void initGaudiHistosConstructor();
2748 // ==========================================================================
2754 void monitorHisto( const AIDA::IBaseHistogram* hist, const HistoID& ID ) const;
2755 // ==========================================================================
2760 void newHistoID( const std::string& title, HistoID& ID ) const;
2761 // ==========================================================================
2762 protected:
2763 // ==========================================================================
2765 std::string convertTitleToID( std::string title ) const;
2766 // ==========================================================================
2767 private:
2768 // ==========================================================================
2770 void printHistoHandler( Gaudi::Details::PropertyBase& /* theProp */ ); // "HistoPrint"
2771 // ==========================================================================
2772 private:
2773 Gaudi::Property<bool> m_produceHistos{this, "HistoProduce", true, "Switch on/off the production of histograms"};
2774 Gaudi::Property<bool> m_histosPrint{this, "HistoPrint", false,
2775 "Switch on/off the printout of histograms at finalization"};
2776 Gaudi::Property<bool> m_histoCountersPrint{this, "HistoCountersPrint", true,
2777 "Switch on/off the printout of histogram counters at finalization"};
2778 Gaudi::Property<bool> m_checkForNaN{this, "HistoCheckForNaN", true,
2779 "Switch on/off the checks for NaN and Infinity for histogram fill"};
2780 Gaudi::Property<bool> m_splitHistoDir{this, "HistoSplitDir", false,
2781 "Split long directory names into short pieces (suitable for HBOOK)"};
2782 Gaudi::Property<HistoID::NumericID> m_histoOffSet{
2783 this, "HistoOffSet", 0, "OffSet for automatically assigned histogram numerical identifiers "};
2784 Gaudi::Property<std::string> m_histoTopDir{this, "HistoTopDir", "",
2785 "Top level histogram directory (take care that it ends with '/')"};
2786 Gaudi::Property<std::string> m_histoDir{
2787 this, "HistoDir", boost::algorithm::replace_all_copy( this->name(), ":", "_" ), "Histogram Directory"};
2788 Gaudi::Property<bool> m_fullDetail{this, "FullDetail", false};
2789 Gaudi::Property<bool> m_declareMoniHists{this, "MonitorHistograms", true};
2790 Gaudi::Property<std::string> m_histo1DTableFormat{this, "FormatFor1DHistoTable",
2791 Gaudi::Utils::Histos::Formats::format(),
2792 "Format string for printout of 1D histograms"};
2793 Gaudi::Property<std::string> m_histo1DTableFormatShort{this, "ShortFormatFor1DHistoTable", " | %1$-25.25s %2%",
2794 "Format string for printout of 1D histograms"};
2795 Gaudi::Property<std::string> m_histo1DTableHeader{this, "HeaderFor1DHistoTable",
2796 Gaudi::Utils::Histos::Formats::header(),
2797 "The table header for printout of 1D histograms "};
2798 Gaudi::Property<bool> m_useNumericAutoIDs{
2799 this, "UseSequencialNumericAutoIDs", false,
2800 "Flag to allow users to switch back to the old style of creating numerical automatic IDs"};
2801 Gaudi::Property<std::map<std::string, std::string>> m_idReplaceInfo{
2802 this,
2803 "AutoStringIDPurgeMap",
2804 {{"/", "=SLASH="}},
2805 "Map of strings to search and replace when using the title "
2806 "as the basis of automatically generated literal IDs"};
2807 // ==========================================================================
2809 mutable Histo1DMapTitle m_histo1DMapTitle;
2811 mutable Histo1DMapID m_histo1DMapID;
2812 // ==========================================================================
2814 mutable Histo2DMapTitle m_histo2DMapTitle;
2816 mutable Histo2DMapID m_histo2DMapID;
2817 // ==========================================================================
2819 mutable Histo3DMapTitle m_histo3DMapTitle;
2821 mutable Histo3DMapID m_histo3DMapID;
2822 // ==========================================================================
2824 mutable Profile1DMapTitle m_profile1DMapTitle;
2826 mutable Profile1DMapID m_profile1DMapID;
2827 // ==========================================================================
2829 mutable Profile2DMapTitle m_profile2DMapTitle;
2831 mutable Profile2DMapID m_profile2DMapID;
2832 // ==========================================================================
2833 };
2834 // ============================================================================
2835 // The END
2836 // ============================================================================
2837 #endif // GAUDIALG_GAUDIHISTOS_H
2838 // ============================================================================
GaudiHistos::setFullDetail
void setFullDetail(const bool val)
set flag to control output level of histograms
Definition: GaudiHistos.h:2682
GaudiHistos::histoOffSet
HistoID::NumericID histoOffSet() const
get the value for histogram offset (property "HistoOffSet")
Definition: GaudiHistos.h:2404
GaudiHistos::fullDetail
bool fullDetail() const
get flag to control output level of histograms
Definition: GaudiHistos.h:2398
GaudiHistos::book
AIDA::IHistogram1D * book(const HistoID &ID, const std::string &title, const double low=0, const double high=100, const unsigned long bins=100) const
book the 1D histogram with forced ID
Definition: GaudiHistos.h:1907
GaudiHistos::Histo3DMapID
GaudiAlg::Histo3DMapID Histo3DMapID
the actual type for (ID)->(3D histogram) mapping
Definition: GaudiHistos.h:74
GaudiTool.h
Header file for class GaudiAlgorithm.
GaudiHistos::Histo1DMapTitle
GaudiAlg::Histo1DMapTitle Histo1DMapTitle
the actual type for title->(1D histogram) mapping
Definition: GaudiHistos.h:66
GaudiHistos::histo2D
AIDA::IHistogram2D * histo2D(const std::string &title) const
access the EXISTING 2D histogram by title return the pointer to existing 2D histogram or NULL ...
Definition: GaudiHistos.h:2306
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
GaudiHistos::profile2D
AIDA::IProfile2D * profile2D(const std::string &title) const
access the EXISTING 2D profile histogram by title return the pointer to existing 2D profile histogram...
Definition: GaudiHistos.h:2333
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
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:95
GaudiHistos::m_profile1DMapID
Profile1DMapID m_profile1DMapID
the actual storage/access of 1D profile histograms by unique ID
Definition: GaudiHistos.h:2826
GaudiHistos::Profile1DMapTitle
GaudiAlg::Profile1DMapTitle Profile1DMapTitle
the actual type for title->(1D profile histogram) mapping
Definition: GaudiHistos.h:81
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
GaudiHistos::plot
AIDA::IHistogram1D * plot(const double value, const HistoID &ID, const Gaudi::Histo1DDef &hdef, const double weight=1.0) const
fill the 1D histogram (book on demand)
Definition: GaudiHistos.h:328
GaudiHistos::plot
AIDA::IHistogram1D * plot(const double value, const std::string &title, const double low, const double high, const unsigned long bins=100, const double weight=1.0) const
fill the 1D histogram (book on demand)
Definition: GaudiHistos.h:154
GaudiHistos::HistoID
GaudiAlg::HistoID HistoID
the actual type for histogram identifier
Definition: GaudiHistos.h:61
GaudiHistos::histo
AIDA::IHistogram1D * histo(const HistoID &ID) const
access the EXISTING 1D histogram by ID
Definition: GaudiHistos.h:2353
GaudiHistos::profile2DMapID
const Profile2DMapID & profile2DMapID() const
get access to the map of 2D profile histograms index via a ID
Definition: GaudiHistos.h:2675
GaudiAlgorithm.h
Header file for class GaudiAlgorithm.
GaudiHistos::m_histo1DMapID
Histo1DMapID m_histo1DMapID
the actual storage/access of 1D histograms by unique ID
Definition: GaudiHistos.h:2811
GaudiAlg::ID::NumericID
int NumericID
type for internal numeric ID
Definition: GaudiHistoID.h:49
GaudiHistos::plot
AIDA::IHistogram1D * plot(const FUNCTION &func, OBJECT first, OBJECT last, const std::string &title, const double low, const double high, const unsigned long bins, const WEIGHT &weight) const
book and fill the 1D histogram with information from [first,last) sequence with given weight ...
Definition: GaudiHistos.h:561
HistoTableFormat.h
GaudiHistos::m_histo3DMapTitle
Histo3DMapTitle m_histo3DMapTitle
the actual storage/access of 3D histograms by unique title
Definition: GaudiHistos.h:2819
HistoProperty.h
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:35
GaudiHistos::setHistoOffSet
void setHistoOffSet(const HistoID::NumericID val)
set a value for histogram offset (property "HistoOffSet"
Definition: GaudiHistos.h:2688
GaudiHistos::histo3DMapTitle
const Histo3DMapTitle & histo3DMapTitle() const
get access to the map of all 3D histograms indexed via their title
Definition: GaudiHistos.h:2550
GaudiHistos::Histo3DMapTitle
GaudiAlg::Histo3DMapTitle Histo3DMapTitle
the actual type for title->(3D histogram) mapping
Definition: GaudiHistos.h:76
GaudiHistos::histoExists
bool histoExists(const HistoID &ID) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2385
GaudiHistos::Profile2DMapID
GaudiAlg::Profile2DMapID Profile2DMapID
the actual type for (ID)->(2D profile histogram) mapping
Definition: GaudiHistos.h:84
GaudiHistos::Profile1DMapID
GaudiAlg::Profile1DMapID Profile1DMapID
the actual type for (ID)->(1D profile histogram) mapping
Definition: GaudiHistos.h:79
GaudiHistos::splitHistoDir
bool splitHistoDir() const
get the flag for histogram path split (property "HistoSplitDir")
Definition: GaudiHistos.h:2402
GaudiHistos::profile2DMapTitle
const Profile2DMapTitle & profile2DMapTitle() const
get access to the map of all 2D profile histograms indexed via their title
Definition: GaudiHistos.h:2652
GaudiHistos::HistoBinEdges
GaudiAlg::HistoBinEdges HistoBinEdges
Edges for variable binning.
Definition: GaudiHistos.h:89
GaudiHistos::m_histo2DMapTitle
Histo2DMapTitle m_histo2DMapTitle
the actual storage/access of 2D histograms by unique title
Definition: GaudiHistos.h:2814
Gaudi::Utils::Histos::Formats::header
GAUDI_API std::string header(const int ID=Default)
get the recommended header by enum
Definition: HistoTableFormat.cpp:176
AIDA
GaudiKernel.
Definition: Fill.h:10
GaudiHistos::setProduceHistos
void setProduceHistos(const bool val)
set the flag for histogram production (property "HistoProduce")
Definition: GaudiHistos.h:2680
GaudiHistos::profile1D
AIDA::IProfile1D * profile1D(const std::string &title) const
access the EXISTING 1D profile histogram by title return the pointer to existing 1D profile histogram...
Definition: GaudiHistos.h:2324
GaudiHistos::plot
AIDA::IHistogram1D * plot(const FUNCTION &func, OBJECT first, OBJECT last, const HistoID &ID, const std::string &title, const double low, const double high, const unsigned long bins, const WEIGHT &weight) const
book and fill the 1D histogram with forced ID and information from [first,last) sequence with given w...
Definition: GaudiHistos.h:648
GaudiHistos::histo1DMapTitle
const Histo1DMapTitle & histo1DMapTitle() const
get access to the map of all 1D histograms indexed via their title
Definition: GaudiHistos.h:2449
GaudiHistos::Profile2DMapTitle
GaudiAlg::Profile2DMapTitle Profile2DMapTitle
the actual type for title->(2D profile histogram) mapping
Definition: GaudiHistos.h:86
std::string
STL class.
GaudiHistos::setCheckForNaN
void setCheckForNaN(const bool val)
set the flag for NaN checks (property "HistoCheckForNan")
Definition: GaudiHistos.h:2684
MSG::Level
Level
Definition: IMessageSvc.h:16
GaudiHistos::histo1D
AIDA::IHistogram1D * histo1D(const std::string &title) const
access the EXISTING 1D histogram by title return the pointer to existing 1D histogram or NULL ...
Definition: GaudiHistos.h:2288
GaudiHistos::m_profile1DMapTitle
Profile1DMapTitle m_profile1DMapTitle
the actual storage/access of 1D profile histograms by unique title
Definition: GaudiHistos.h:2824
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:229
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
gaudirun.type
type
Definition: gaudirun.py:133
Gaudi::Utils::Histos::Formats::format
GAUDI_API std::string format(const int ID=Default)
get the format by enum
Definition: HistoTableFormat.cpp:142
Gaudi::Histo1DDef
Simple helper class for description of 1D-histogram The class is targeted to act as the primary "hist...
Definition: HistoDef.h:33
GaudiHistos::plot
AIDA::IHistogram1D * plot(const double value, const Gaudi::Histo1DDef &hdef, const double weight=1.0) const
fill the 1D histogram (book on demand)
Definition: GaudiHistos.h:196
GaudiHistos::GaudiHistos
GaudiHistos(const std::string &type, const std::string &name, const IInterface *parent)
Tool constructor - SFINAE-ed to insure this constructor is only defined if PBASE derives from GaudiTo...
Definition: GaudiHistos.h:2709
GaudiHistos::plot
AIDA::IHistogram1D * plot(const FUNCTION &func, OBJECT first, OBJECT last, const HistoID &ID, const std::string &title, const double low, const double high, const unsigned long bins=100) const
fill the 1D histogram with forced ID and information from [first,last) sequence
Definition: GaudiHistos.h:472
GaudiHistos::histo1DMapID
const Histo1DMapID & histo1DMapID() const
get access to the map of all 1D histograms index via ID
Definition: GaudiHistos.h:2473
GaudiHistos::histo
AIDA::IHistogram1D * histo(const std::string &title) const
access the EXISTING 1D histogram by title
Definition: GaudiHistos.h:2301
GaudiHistos::useNumericAutoIDs
bool useNumericAutoIDs() const
Use old style sequencial numerical automatically assigned IDs ?
Definition: GaudiHistos.h:2416
GaudiHistos::Histo1DMapID
GaudiAlg::Histo1DMapID Histo1DMapID
the actual type for (ID)->(1D histogram) mapping
Definition: GaudiHistos.h:64
GaudiHistos::profile1DMapTitle
const Profile1DMapTitle & profile1DMapTitle() const
get access to the map of all 1D profile histograms indexed via their title
Definition: GaudiHistos.h:2602
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
GaudiHistos::book
AIDA::IHistogram1D * book(const std::string &title, const double low=0, const double high=100, const unsigned long bins=100) const
book the 1D histogram
Definition: GaudiHistos.h:1865
GaudiHistos::m_profile2DMapID
Profile2DMapID m_profile2DMapID
the actual storage/access of 2D profile histograms by unique ID
Definition: GaudiHistos.h:2831
GaudiHistos::Histo2DMapTitle
GaudiAlg::Histo2DMapTitle Histo2DMapTitle
the actual type for title->(2D histogram) mapping
Definition: GaudiHistos.h:71
Maps.h
GaudiHistos::setSplitHistoDir
void setSplitHistoDir(const bool val)
set the flag for histogram path split (property "HistoSplitDir")
Definition: GaudiHistos.h:2686
GaudiHistos::plot
AIDA::IHistogram1D * plot(const double value, const HistoID &ID, const std::string &title, const double low, const double high, const unsigned long bins=100, const double weight=1.0) const
fill the 1D histogram with forced ID assignment (book on demand)
Definition: GaudiHistos.h:283
std::vector< double >
GaudiHistos::GaudiHistos
GaudiHistos(const std::string &name, ISvcLocator *pSvcLocator)
Algorithm constructor - the SFINAE constraint below ensures that this is constructor is only defined ...
Definition: GaudiHistos.h:2701
GaudiHistos::m_histo1DMapTitle
Histo1DMapTitle m_histo1DMapTitle
the actual storage/access of 1D histograms by unique title
Definition: GaudiHistos.h:2809
GaudiHistos::m_profile2DMapTitle
Profile2DMapTitle m_profile2DMapTitle
the actual storage/access of 2D profile histograms by unique title
Definition: GaudiHistos.h:2829
GaudiHistos::profile1DMapID
const Profile1DMapID & profile1DMapID() const
get access to the map of 1D profile histograms index via a ID
Definition: GaudiHistos.h:2625
GaudiHistos::histoCountersPrint
bool histoCountersPrint() const
print histogram counters at finalization ?
Definition: GaudiHistos.h:2414
GaudiHistos::setHistoTopDir
void setHistoTopDir(const std::string &val)
set top-level histogram directory (property "HistoTopDir")
Definition: GaudiHistos.h:2691
GaudiHistos::produceHistos
bool produceHistos() const
get the flag for histogram production (property "HistoProduce")
Definition: GaudiHistos.h:2396
GaudiHistos::Histo2DMapID
GaudiAlg::Histo2DMapID Histo2DMapID
the actual type for (ID)->(2D histogram) mapping
Definition: GaudiHistos.h:69
GaudiHistos::m_histo3DMapID
Histo3DMapID m_histo3DMapID
the actual storage/access of 3D histograms by unique ID
Definition: GaudiHistos.h:2821
GaudiHistos::histoDir
const std::string & histoDir() const
get histogram directory (property "HistoDir")
Definition: GaudiHistos.h:2408
GaudiUtils::HashMap
Common class providing an architecture-independent hash map.
Definition: HashMap.h:74
GaudiHistos::histoTopDir
const std::string & histoTopDir() const
get top-level histogram directory (property "HistoTopDir")
Definition: GaudiHistos.h:2406
GaudiHistos::plot
AIDA::IHistogram1D * plot(const FUNCTION &func, OBJECT first, OBJECT last, const std::string &title, const double low, const double high, const unsigned long bins=100) const
fill the 1D histogram with information from [first,last) sequence
Definition: GaudiHistos.h:397
GaudiHistos::histo2DMapID
const Histo2DMapID & histo2DMapID() const
get access to the map of 2D histograms index via ID
Definition: GaudiHistos.h:2523
gaudirun.level
level
Definition: gaudirun.py:271
GaudiHistos::m_histo2DMapID
Histo2DMapID m_histo2DMapID
the actual storage/access of 2D histograms by unique ID
Definition: GaudiHistos.h:2816
GaudiHistos::setHistoDir
void setHistoDir(const std::string &val)
set histogram directory (property "HistoDir")
Definition: GaudiHistos.h:2694
GaudiHistos
Templated base class providing common histogramming methods for GaudiAlgorithm and GaudiTool like cla...
Definition: GaudiHistos.h:56
GaudiHistos::histoExists
bool histoExists(const std::string &title) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2378
GaudiHistos::histo2DMapTitle
const Histo2DMapTitle & histo2DMapTitle() const
get access to the map of all 2D histograms indexed via their title
Definition: GaudiHistos.h:2500
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
MSG::ALWAYS
Definition: IMessageSvc.h:16
GaudiAlg::ID
ID class for Histogram and Ntuples.
Definition: GaudiHistoID.h:44
GaudiHistos::histo3D
AIDA::IHistogram3D * histo3D(const std::string &title) const
access the EXISTING 3D histogram by title return the pointer to existing 3D histogram or NULL ...
Definition: GaudiHistos.h:2315
GaudiHistos::histosPrint
bool histosPrint() const
print histograms at finalization ?
Definition: GaudiHistos.h:2412
GaudiHistos::histo3DMapID
const Histo3DMapID & histo3DMapID() const
get access to the map of all 3D histograms index via a ID
Definition: GaudiHistos.h:2573
GaudiHistos::checkForNaN
bool checkForNaN() const
get the flag for NaN checks (property "HistoCheckForNan")
Definition: GaudiHistos.h:2400
std::numeric_limits