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 <vector>
20 // ============================================================================
21 // GaudiKernel
22 // ============================================================================
24 // ============================================================================
25 // GaudiUtils
26 // ============================================================================
28 // ============================================================================
29 // GaudiAlg
30 // ============================================================================
31 #include "GaudiAlg/Maps.h"
32 // ============================================================================
33 // Forward declarations
34 namespace AIDA
35 {
36  class IHistogram1D;
37  class IHistogram2D;
38  class IHistogram3D;
39  class IProfile1D;
40  class IProfile2D;
41 }
42 // ============================================================================
52 template <class PBASE>
53 class GAUDI_API GaudiHistos : public PBASE
54 {
55 public:
56  // ==========================================================================
59  // ==========================================================================
64  // ==========================================================================
69  // ==========================================================================
74  // ==========================================================================
79  // ==========================================================================
84  // ==========================================================================
87  // ==========================================================================
88 public:
89  // ==========================================================================
90  // ================================= 1D Histograms ==========================
91  // ================================= Fixed Binning ==========================
92  // ==========================================================================
135  AIDA::IHistogram1D* plot1D( const double value, const std::string& title, const double low, const double high,
136  const unsigned long bins = 100, const double weight = 1.0 ) const;
137  // ==========================================================================
151  inline AIDA::IHistogram1D* plot( const double value, const std::string& title, const double low, const double high,
152  const unsigned long bins = 100, const double weight = 1.0 ) const
153  {
154  return plot1D( value, title, low, high, bins, weight );
155  }
156  // ==========================================================================
181  AIDA::IHistogram1D* plot1D( const double value, const Gaudi::Histo1DDef& hdef, const double weight = 1.0 ) const;
182  // ==========================================================================
193  inline AIDA::IHistogram1D* plot( const double value, const Gaudi::Histo1DDef& hdef, const double weight = 1.0 ) const
194  {
195  return plot1D( value, hdef, weight );
196  }
197  // ==========================================================================
262  // ==========================================================================
263  AIDA::IHistogram1D* plot1D( const double value, const HistoID& ID, const std::string& title, const double low,
264  const double high, const unsigned long bins = 100, const double weight = 1.0 ) const;
265  // ==========================================================================
280  inline AIDA::IHistogram1D* plot( const double value, const HistoID& ID, const std::string& title, const double low,
281  const double high, const unsigned long bins = 100, const double weight = 1.0 ) const
282  {
283  return plot1D( value, ID, title, low, high, bins, weight );
284  }
285  // ==========================================================================
311  AIDA::IHistogram1D* plot1D( const double value, const HistoID& ID, const Gaudi::Histo1DDef& hdef,
312  const double weight = 1.0 ) const;
313  // ==========================================================================
325  inline AIDA::IHistogram1D* plot( const double value, const HistoID& ID, const Gaudi::Histo1DDef& hdef,
326  const double weight = 1.0 ) const
327  {
328  return plot1D( value, ID, hdef, weight );
329  }
393  template <class FUNCTION, class OBJECT>
394  inline AIDA::IHistogram1D* plot( const FUNCTION& func, OBJECT first, OBJECT last, const std::string& title,
395  const double low, const double high, const unsigned long bins = 100 ) const
396  {
397  AIDA::IHistogram1D* h = nullptr;
398  if ( produceHistos() ) {
399  // retrieve or book the histogram
400  h = histo1D( title );
401  if ( !h ) {
402  h = book1D( title, low, high, bins );
403  }
404  // fill histogram
405  while ( first != last && h ) {
406  h = fill( h, func( *first ), 1.0, title );
407  ++first;
408  }
409  }
410  return h;
411  }
412  // ==========================================================================
468  template <class FUNCTION, class OBJECT>
469  inline AIDA::IHistogram1D* plot( const FUNCTION& func, OBJECT first, OBJECT last, const HistoID& ID,
470  const std::string& title, const double low, const double high,
471  const unsigned long bins = 100 ) const
472  {
473  AIDA::IHistogram1D* h( 0 );
474  if ( produceHistos() ) {
475  // retrieve or book the histogram
476  h = histo1D( ID );
477  if ( !h ) {
478  h = book1D( ID, title, low, high, bins );
479  }
480  // fill histogram
481  while ( first != last && h ) {
482  h = fill( h, func( *first ), 1.0, title );
483  ++first;
484  }
485  }
486  return h;
487  }
488  // ==========================================================================
557  template <class FUNCTION, class OBJECT, class WEIGHT>
558  inline AIDA::IHistogram1D* plot( const FUNCTION& func, OBJECT first, OBJECT last, const std::string& title,
559  const double low, const double high, const unsigned long bins,
560  const WEIGHT& weight ) const
561  {
562  AIDA::IHistogram1D* h = nullptr;
563  if ( produceHistos() ) {
564  // retrieve or book the histogram
565  h = histo1D( title );
566  if ( !h ) {
567  h = book1D( title, low, high, bins );
568  }
569  // fill histogram
570  while ( first != last && h ) {
571  h = fill( h, func( *first ), weight( *first ), title );
572  ++first;
573  }
574  }
575  return h;
576  }
577  // ==========================================================================
644  template <class FUNCTION, class OBJECT, class WEIGHT>
645  inline AIDA::IHistogram1D* plot( const FUNCTION& func, OBJECT first, OBJECT last, const HistoID& ID,
646  const std::string& title, const double low, const double high,
647  const unsigned long bins, const WEIGHT& weight ) const
648  {
649  AIDA::IHistogram1D* h = nullptr;
650  if ( produceHistos() ) {
651  // retrieve or book the histogram
652  h = histo1D( ID );
653  if ( !h ) {
654  h = book1D( ID, title, low, high, bins );
655  }
656  // fill histogram
657  while ( first != last && h ) {
658  h = fill( h, func( *first ), weight( *first ), title );
659  ++first;
660  }
661  }
662  return h;
663  }
664  // ==========================================================================
665  // ================================= 1D Histograms ==========================
666  // =============================== Variable Binning =========================
667  // ==========================================================================
707  AIDA::IHistogram1D* plot1D( const double value, const std::string& title, const HistoBinEdges& edges,
708  const double weight = 1.0 ) const;
709  // ==========================================================================
773  // ==========================================================================
774  AIDA::IHistogram1D* plot1D( const double value, const HistoID& ID, const std::string& title,
775  const HistoBinEdges& edges, const double weight = 1.0 ) const;
776  // ==========================================================================
777  // ================================= 2D Histograms ==========================
778  // ==========================================================================
829  AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const std::string& title, const double lowX,
830  const double highX, const double lowY, const double highY, const unsigned long binsX = 50,
831  const unsigned long binsY = 50, const double weight = 1.0 ) const;
832  // ==========================================================================
909  AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
910  const double lowX, const double highX, const double lowY, const double highY,
911  const unsigned long binsX = 50, const unsigned long binsY = 50,
912  const double weight = 1.0 ) const;
913  // ==========================================================================
914  // ================================= 2D Histograms ==========================
915  // =============================== Variable Binning =========================
916  // ==========================================================================
962  AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const std::string& title,
963  const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
964  const double weight = 1.0 ) const;
965  // ==========================================================================
1041  AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
1042  const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
1043  const double weight = 1.0 ) const;
1044  // ==========================================================================
1045  // ================================= 3D Histograms ==========================
1046  // ==========================================================================
1105  AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const std::string& title,
1106  const double lowX, const double highX, const double lowY, const double highY,
1107  const double lowZ, const double highZ, const unsigned long binsX = 10,
1108  const unsigned long binsY = 10, const unsigned long binsZ = 10,
1109  const double weight = 1.0 ) const;
1110  // ==========================================================================
1197  AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
1198  const std::string& title, const double lowX, const double highX, const double lowY,
1199  const double highY, const double lowZ, const double highZ, const unsigned long binsX = 10,
1200  const unsigned long binsY = 10, const unsigned long binsZ = 10,
1201  const double weight = 1.0 ) const;
1202  // ==========================================================================
1203  // ================================= 3D Histograms ==========================
1204  // =============================== Variable Binning =========================
1205  // ==========================================================================
1253  AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const std::string& title,
1254  const HistoBinEdges& edgesX, const HistoBinEdges& edgesY, const HistoBinEdges& edgesZ,
1255  const double weight = 1.0 ) const;
1256  // ==========================================================================
1257  // ==========================================================================
1342  AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
1343  const std::string& title, const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
1344  const HistoBinEdges& edgesZ, const double weight = 1.0 ) const;
1345  // ==========================================================================
1346  // ================================= 1D Profile =============================
1347  // ================================= Fixed binning ==========================
1348  // ==========================================================================
1397  AIDA::IProfile1D* profile1D( const double valueX, const double valueY, const std::string& title, const double lowX,
1398  const double highX, const unsigned long binsX = 100, const std::string& opt = "",
1399  const double lowY = -std::numeric_limits<double>::max(),
1400  const double highY = std::numeric_limits<double>::max(),
1401  const double weight = 1.0 ) const;
1402  // ==========================================================================
1468  AIDA::IProfile1D* profile1D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
1469  const double lowX, const double highX, const unsigned long binsX = 100,
1470  const std::string& opt = "", const double lowY = -std::numeric_limits<double>::max(),
1471  const double highY = std::numeric_limits<double>::max(),
1472  const double weight = 1.0 ) const;
1473  // ==========================================================================
1474  // ================================= 1D Profile =============================
1475  // ============================== Variable binning ==========================
1476  // ==========================================================================
1519  AIDA::IProfile1D* profile1D( const double valueX, const double valueY, const std::string& title,
1520  const HistoBinEdges& edges, const double weight = 1.0 ) const;
1521  // ==========================================================================
1583  AIDA::IProfile1D* profile1D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
1584  const HistoBinEdges& edges, const double weight = 1.0 ) const;
1585  // ==========================================================================
1586  // ================================= 2D Profile =============================
1587  // ==========================================================================
1638  AIDA::IProfile2D* profile2D( const double valueX, const double valueY, const double valueZ, const std::string& title,
1639  const double lowX, const double highX, const double lowY, const double highY,
1640  const unsigned long binsX = 50, const unsigned long binsY = 50,
1641  const double weight = 1.0 ) const;
1642  // ==========================================================================
1710  AIDA::IProfile2D* profile2D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
1711  const std::string& title, const double lowX, const double highX, const double lowY,
1712  const double highY, const unsigned long binsX = 50, const unsigned long binsY = 50,
1713  const double weight = 1.0 ) const;
1714  // ==========================================================================
1715  // ================================= 2D Profile =============================
1716  // ============================== Variable binning ==========================
1717  // ==========================================================================
1763  AIDA::IProfile2D* profile2D( const double valueX, const double valueY, const double valueZ, const std::string& title,
1764  const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
1765  const double weight = 1.0 ) const;
1766  // ==========================================================================
1829  AIDA::IProfile2D* profile2D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
1830  const std::string& title, const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
1831  const double weight = 1.0 ) const;
1832  // ==========================================================================
1833 
1834 public: // 1D Fixed
1835  // ==========================================================================
1847  AIDA::IHistogram1D* book1D( const std::string& title, const double low = 0, const double high = 100,
1848  const unsigned long bins = 100 ) const;
1849  // ==========================================================================
1862  inline AIDA::IHistogram1D* book( const std::string& title, const double low = 0, const double high = 100,
1863  const unsigned long bins = 100 ) const
1864  {
1865  return book1D( title, low, high, bins );
1866  }
1867  // ==========================================================================
1876  AIDA::IHistogram1D* book( const Gaudi::Histo1DDef& hdef ) const;
1877  // ==========================================================================
1888  AIDA::IHistogram1D* book1D( const HistoID& ID, const std::string& title, const double low = 0,
1889  const double high = 100, const unsigned long bins = 100 ) const;
1890  // ==========================================================================
1904  inline AIDA::IHistogram1D* book( const HistoID& ID, const std::string& title, const double low = 0,
1905  const double high = 100, const unsigned long bins = 100 ) const
1906  {
1907  return book1D( ID, title, low, high, bins );
1908  }
1909  // ==========================================================================
1917  inline AIDA::IHistogram1D* book( const HistoID& ID, const Gaudi::Histo1DDef& hdef ) const;
1918  // ==========================================================================
1919 
1920 public: // 1D Variable
1921  // ==========================================================================
1932  AIDA::IHistogram1D* book1D( const std::string& title, const HistoBinEdges& edges ) const;
1933  // ==========================================================================
1943  AIDA::IHistogram1D* book1D( const HistoID& ID, const std::string& title, const HistoBinEdges& edges ) const;
1944  // ==========================================================================
1945 
1946 public: // 2D Fixed
1947  // ==========================================================================
1962  AIDA::IHistogram2D* book2D( const std::string& title, const double lowX = 0, const double highX = 100,
1963  const unsigned long binsX = 50, const double lowY = 0, const double highY = 100,
1964  const unsigned long binsY = 50 ) const;
1965  // ==========================================================================
1976  AIDA::IHistogram2D* book2D( const HistoID& ID, const std::string& title, const double lowX = 0,
1977  const double highX = 100, const unsigned long binsX = 50, const double lowY = 0,
1978  const double highY = 100, const unsigned long binsY = 50 ) const;
1979  // ==========================================================================
1980 
1981 public: // 2D Variable
1982  // ==========================================================================
1994  AIDA::IHistogram2D* book2D( const std::string& title, const HistoBinEdges& edgesX,
1995  const HistoBinEdges& edgesY ) const;
1996  // ==========================================================================
2007  AIDA::IHistogram2D* book2D( const HistoID& ID, const std::string& title, const HistoBinEdges& edgesX,
2008  const HistoBinEdges& edgesY ) const;
2009  // ==========================================================================
2010 
2011 public: // 3D Fixed
2012  // ==========================================================================
2030  AIDA::IHistogram3D* book3D( const std::string& title, const double lowX = 0, const double highX = 100,
2031  const unsigned long binsX = 10, const double lowY = 0, const double highY = 100,
2032  const unsigned long binsY = 10, const double lowZ = 0, const double highZ = 100,
2033  const unsigned long binsZ = 10 ) const;
2034  // ==========================================================================
2051  AIDA::IHistogram3D* book3D( const HistoID& ID, const std::string& title, const double lowX = 0,
2052  const double highX = 100, const unsigned long binsX = 10, const double lowY = 0,
2053  const double highY = 100, const unsigned long binsY = 10, const double lowZ = 0,
2054  const double highZ = 100, const unsigned long binsZ = 10 ) const;
2055  // ==========================================================================
2056 
2057 public: // 3D Variable
2058  // ==========================================================================
2071  AIDA::IHistogram3D* book3D( const std::string& title, const HistoBinEdges& edgesX, const HistoBinEdges& edgesY,
2072  const HistoBinEdges& edgesZ ) const;
2073  // ==========================================================================
2085  AIDA::IHistogram3D* book3D( const HistoID& ID, const std::string& title, const HistoBinEdges& edgesX,
2086  const HistoBinEdges& edgesY, const HistoBinEdges& edgesZ ) const;
2087  // ==========================================================================
2088 
2089 public: // 1D Fixed Profiles
2090  // ==========================================================================
2105  AIDA::IProfile1D* bookProfile1D( const std::string& title, const double low = 0, const double high = 100,
2106  const unsigned long bins = 100, const std::string& opt = "",
2107  const double lowY = -std::numeric_limits<double>::max(),
2108  const double highY = std::numeric_limits<double>::max() ) const;
2109  // ==========================================================================
2125  AIDA::IProfile1D* bookProfile1D( const HistoID& ID, const std::string& title, const double low = 0,
2126  const double high = 100, const unsigned long bins = 100, const std::string& opt = "",
2127  const double lowY = -std::numeric_limits<double>::max(),
2128  const double highY = std::numeric_limits<double>::max() ) const;
2129  // ==========================================================================
2130 
2131 public: // 1D Variable Profiles
2132  // ==========================================================================
2142  AIDA::IProfile1D* bookProfile1D( const std::string& title, const HistoBinEdges& edges ) const;
2143  // ==========================================================================
2153  AIDA::IProfile1D* bookProfile1D( const HistoID& ID, const std::string& title, const HistoBinEdges& edges ) const;
2154  // ==========================================================================
2155 
2156 public: // 2D Profiles
2157  // ==========================================================================
2172  AIDA::IProfile2D* bookProfile2D( const std::string& title, const double lowX = 0, const double highX = 100,
2173  const unsigned long binsX = 50, const double lowY = 0, const double highY = 100,
2174  const unsigned long binsY = 50 ) const;
2175  // ==========================================================================
2189  AIDA::IProfile2D* bookProfile2D( const HistoID& ID, const std::string& title, const double lowX = 0,
2190  const double highX = 100, const unsigned long binsX = 50, const double lowY = 0,
2191  const double highY = 100, const unsigned long binsY = 50 ) const;
2192  // ==========================================================================
2193 
2194 public: // 2D Profiles
2195  // ==========================================================================
2206  AIDA::IProfile2D* bookProfile2D( const std::string& title, const HistoBinEdges& edgesX,
2207  const HistoBinEdges& edgesY ) const;
2208  // ==========================================================================
2218  AIDA::IProfile2D* bookProfile2D( const HistoID& ID, const std::string& title, const HistoBinEdges& edgesX,
2219  const HistoBinEdges& edgesY ) const;
2220  // ==========================================================================
2221 
2222 public:
2223  // ==========================================================================
2231  AIDA::IHistogram1D* fill( AIDA::IHistogram1D* histo, const double value, const double weight,
2232  const std::string& title = "" ) const;
2233  // ==========================================================================
2242  AIDA::IHistogram2D* fill( AIDA::IHistogram2D* histo, const double valueX, const double valueY, const double weight,
2243  const std::string& title = "" ) const;
2244  // ==========================================================================
2254  AIDA::IHistogram3D* fill( AIDA::IHistogram3D* histo, const double valueX, const double valueY, const double valueZ,
2255  const double weight, const std::string& title = "" ) const;
2256  // ==========================================================================
2265  AIDA::IProfile1D* fill( AIDA::IProfile1D* histo, const double valueX, const double valueY, const double weight,
2266  const std::string& title = "" ) const;
2267  // ==========================================================================
2277  AIDA::IProfile2D* fill( AIDA::IProfile2D* histo, const double valueX, const double valueY, const double valueZ,
2278  const double weight, const std::string& title = "" ) const;
2279  // ==========================================================================
2280 public:
2281  // ==========================================================================
2285  inline AIDA::IHistogram1D* histo1D( const std::string& title ) const
2286  {
2287  auto found = histo1DMapTitle().find( title );
2288  return found != histo1DMapTitle().end() ? found->second : nullptr;
2289  }
2290  // ==========================================================================
2298  inline AIDA::IHistogram1D* histo( const std::string& title ) const { return histo1D( title ); }
2299  // ==========================================================================
2303  inline AIDA::IHistogram2D* histo2D( const std::string& title ) const
2304  {
2305  auto found = histo2DMapTitle().find( title );
2306  return histo2DMapTitle().end() != found ? found->second : nullptr;
2307  }
2308  // ==========================================================================
2312  inline AIDA::IHistogram3D* histo3D( const std::string& title ) const
2313  {
2314  auto found = histo3DMapTitle().find( title );
2315  return histo3DMapTitle().end() != found ? found->second : nullptr;
2316  }
2317  // ==========================================================================
2321  inline AIDA::IProfile1D* profile1D( const std::string& title ) const
2322  {
2323  auto found = profile1DMapTitle().find( title );
2324  return profile1DMapTitle().end() != found ? found->second : nullptr;
2325  }
2326  // ==========================================================================
2330  inline AIDA::IProfile2D* profile2D( const std::string& title ) const
2331  {
2332  auto found = profile2DMapTitle().find( title );
2333  return profile2DMapTitle().end() != found ? found->second : nullptr;
2334  }
2335  // ==========================================================================
2336 public:
2337  // ==========================================================================
2341  AIDA::IHistogram1D* histo1D( const HistoID& ID ) const;
2342  // ==========================================================================
2350  inline AIDA::IHistogram1D* histo( const HistoID& ID ) const { return histo1D( ID ); }
2351  // ==========================================================================
2355  AIDA::IHistogram2D* histo2D( const HistoID& ID ) const;
2356  // ==========================================================================
2360  AIDA::IHistogram3D* histo3D( const HistoID& ID ) const;
2361  // ==========================================================================
2365  AIDA::IProfile1D* profile1D( const HistoID& ID ) const;
2366  // ==========================================================================
2370  AIDA::IProfile2D* profile2D( const HistoID& ID ) const;
2371  // ==========================================================================
2372 public:
2373  // ==========================================================================
2375  inline bool histoExists( const std::string& title ) const
2376  {
2377  return ( 0 != histo( title ) || 0 != histo2D( title ) || 0 != histo3D( title ) || 0 != profile1D( title ) ||
2378  0 != profile2D( title ) );
2379  }
2380  // ==========================================================================
2382  inline bool histoExists( const HistoID& ID ) const
2383  {
2384  return ( 0 != histo( ID ) || 0 != histo2D( ID ) || 0 != histo3D( ID ) || 0 != profile1D( ID ) ||
2385  0 != profile2D( ID ) );
2386  }
2388  unsigned int totalNumberOfHistos() const;
2389  // ==========================================================================
2390 public: // trivial & non-trivial accessors
2391  // ==========================================================================
2393  inline bool produceHistos() const { return m_produceHistos; }
2395  inline bool fullDetail() const { return m_fullDetail; }
2397  inline bool checkForNaN() const { return m_checkForNaN; }
2399  inline bool splitHistoDir() const { return m_splitHistoDir; }
2401  inline HistoID::NumericID histoOffSet() const { return m_histoOffSet; }
2403  inline const std::string& histoTopDir() const { return m_histoTopDir; }
2405  inline const std::string& histoDir() const { return m_histoDir; }
2407  std::string histoPath() const;
2409  inline bool histosPrint() const { return m_histosPrint; }
2411  inline bool histoCountersPrint() const { return m_histoCountersPrint; }
2413  inline bool useNumericAutoIDs() const { return m_useNumericAutoIDs; }
2414  // ==========================================================================
2419  int printHistos( const MSG::Level level = MSG::ALWAYS ) const;
2420  // ==========================================================================
2446  const Histo1DMapTitle& histo1DMapTitle() const { return m_histo1DMapTitle; }
2447  // ==========================================================================
2470  const Histo1DMapID& histo1DMapID() const { return m_histo1DMapID; }
2471  // ==========================================================================
2497  const Histo2DMapTitle& histo2DMapTitle() const { return m_histo2DMapTitle; }
2498  // ==========================================================================
2520  const Histo2DMapID& histo2DMapID() const { return m_histo2DMapID; }
2521  // ==========================================================================
2547  const Histo3DMapTitle& histo3DMapTitle() const { return m_histo3DMapTitle; }
2548  // ==========================================================================
2570  const Histo3DMapID& histo3DMapID() const { return m_histo3DMapID; }
2571  // ==========================================================================
2599  const Profile1DMapTitle& profile1DMapTitle() const { return m_profile1DMapTitle; }
2600  // ==========================================================================
2622  const Profile1DMapID& profile1DMapID() const { return m_profile1DMapID; }
2623  // ==========================================================================
2649  const Profile2DMapTitle& profile2DMapTitle() const { return m_profile2DMapTitle; }
2650  // ==========================================================================
2672  const Profile2DMapID& profile2DMapID() const { return m_profile2DMapID; }
2673  // ==========================================================================
2674 public: // trivial setters
2675  // ==========================================================================
2677  inline void setProduceHistos( const bool val ) { m_produceHistos = val; }
2679  inline void setFullDetail( const bool val ) { m_fullDetail = val; }
2681  inline void setCheckForNaN( const bool val ) { m_checkForNaN = val; }
2683  inline void setSplitHistoDir( const bool val ) { m_splitHistoDir = val; }
2685  inline void setHistoOffSet( const HistoID::NumericID val ) { m_histoOffSet = val; }
2686  // ==========================================================================
2688  inline void setHistoTopDir( const std::string& val ) { m_histoTopDir = val; }
2689  // ==========================================================================
2691  inline void setHistoDir( const std::string& val ) { m_histoDir = val; }
2692  // ==========================================================================
2693 public:
2694  // ==========================================================================
2696  GaudiHistos( const std::string& name, ISvcLocator* pSvcLocator );
2697  // ==========================================================================
2699  GaudiHistos( const std::string& type, const std::string& name, const IInterface* parent );
2700  // ==========================================================================
2702  ~GaudiHistos() override = default;
2703  // ==========================================================================
2704 protected:
2705  // ==========================================================================
2709  StatusCode initialize() override
2710 #ifdef __ICC
2711  {
2712  return i_ghInitialize();
2713  }
2714  StatusCode i_ghInitialize()
2715 #endif
2716  ;
2717  // ==========================================================================
2721  StatusCode finalize() override
2722 #ifdef __ICC
2723  {
2724  return i_ghFinalize();
2725  }
2726  StatusCode i_ghFinalize()
2727 #endif
2728  ;
2729  // ==========================================================================
2730 private:
2731  // ==========================================================================
2733  bool noHistos() const;
2734  // ===========================================unsigned===============================
2736  void initGaudiHistosConstructor();
2737  // ==========================================================================
2743  void monitorHisto( const AIDA::IBaseHistogram* hist, const HistoID& ID ) const;
2744  // ==========================================================================
2749  void newHistoID( const std::string& title, HistoID& ID ) const;
2750  // ==========================================================================
2751 protected:
2752  // ==========================================================================
2754  std::string convertTitleToID( std::string title ) const;
2755  // ==========================================================================
2756 private:
2757  // ==========================================================================
2759  void printHistoHandler( Gaudi::Details::PropertyBase& /* theProp */ ); // "HistoPrint"
2760  // ==========================================================================
2761 private:
2762  Gaudi::Property<bool> m_produceHistos{this, "HistoProduce", true, "Switch on/off the production of histograms"};
2763  Gaudi::Property<bool> m_histosPrint{this, "HistoPrint", false,
2764  "Switch on/off the printout of histograms at finalization"};
2765  Gaudi::Property<bool> m_histoCountersPrint{this, "HistoCountersPrint", true,
2766  "Switch on/off the printout of histogram counters at finalization"};
2767  Gaudi::Property<bool> m_checkForNaN{this, "HistoCheckForNaN", true,
2768  "Switch on/off the checks for NaN and Infinity for histogram fill"};
2769  Gaudi::Property<bool> m_splitHistoDir{this, "HistoSplitDir", false,
2770  "Split long directory names into short pieces (suitable for HBOOK)"};
2772  this, "HistoOffSet", 0, "OffSet for automatically assigned histogram numerical identifiers "};
2773  Gaudi::Property<std::string> m_histoTopDir{this, "HistoTopDir", "",
2774  "Top level histogram directory (take care that it ends with '/')"};
2776  this, "HistoDir", boost::algorithm::replace_all_copy( this->name(), ":", "_" ), "Histogram Directory"};
2777  Gaudi::Property<bool> m_fullDetail{this, "FullDetail", false};
2778  Gaudi::Property<bool> m_declareMoniHists{this, "MonitorHistograms", true};
2779  Gaudi::Property<std::string> m_histo1DTableFormat{this, "FormatFor1DHistoTable",
2781  "Format string for printout of 1D histograms"};
2782  Gaudi::Property<std::string> m_histo1DTableFormatShort{this, "ShortFormatFor1DHistoTable", " | %1$-25.25s %2%",
2783  "Format string for printout of 1D histograms"};
2784  Gaudi::Property<std::string> m_histo1DTableHeader{this, "HeaderFor1DHistoTable",
2786  "The table header for printout of 1D histograms "};
2787  Gaudi::Property<bool> m_useNumericAutoIDs{
2788  this, "UseSequencialNumericAutoIDs", false,
2789  "Flag to allow users to switch back to the old style of creating numerical automatic IDs"};
2791  this,
2792  "AutoStringIDPurgeMap",
2793  {{"/", "=SLASH="}},
2794  "Map of strings to search and replace when using the title "
2795  "as the basis of automatically generated literal IDs"};
2796  // ==========================================================================
2798  mutable Histo1DMapTitle m_histo1DMapTitle;
2800  mutable Histo1DMapID m_histo1DMapID;
2801  // ==========================================================================
2803  mutable Histo2DMapTitle m_histo2DMapTitle;
2805  mutable Histo2DMapID m_histo2DMapID;
2806  // ==========================================================================
2808  mutable Histo3DMapTitle m_histo3DMapTitle;
2810  mutable Histo3DMapID m_histo3DMapID;
2811  // ==========================================================================
2813  mutable Profile1DMapTitle m_profile1DMapTitle;
2815  mutable Profile1DMapID m_profile1DMapID;
2816  // ==========================================================================
2818  mutable Profile2DMapTitle m_profile2DMapTitle;
2820  mutable Profile2DMapID m_profile2DMapID;
2821  // ==========================================================================
2822 };
2823 // ============================================================================
2824 // The END
2825 // ============================================================================
2826 #endif // GAUDIALG_GAUDIHISTOS_H
2827 // ============================================================================
void setFullDetail(const bool val)
set flag to control output level of histograms
Definition: GaudiHistos.h:2679
HistoID::NumericID histoOffSet() const
get the value for histogram offset (property "HistoOffSet")
Definition: GaudiHistos.h:2401
bool fullDetail() const
get flag to control output level of histograms
Definition: GaudiHistos.h:2395
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:1904
GaudiAlg::Histo3DMapID Histo3DMapID
the actual type for (ID)->(3D histogram) mapping
Definition: GaudiHistos.h:71
GaudiAlg::Histo1DMapTitle Histo1DMapTitle
the actual type for title->(1D histogram) mapping
Definition: GaudiHistos.h:63
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:2303
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
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:2330
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
Profile1DMapID m_profile1DMapID
the actual storage/access of 1D profile histograms by unique ID
Definition: GaudiHistos.h:2815
GaudiAlg::Profile1DMapTitle Profile1DMapTitle
the actual type for title->(1D profile histogram) mapping
Definition: GaudiHistos.h:78
Implementation of property with value of concrete type.
Definition: Property.h:313
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:325
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:151
GaudiAlg::HistoID HistoID
the actual type for histogram identifier
Definition: GaudiHistos.h:58
AIDA::IHistogram1D * histo(const HistoID &ID) const
access the EXISTING 1D histogram by ID
Definition: GaudiHistos.h:2350
const Profile2DMapID & profile2DMapID() const
get access to the map of 2D profile histograms index via a ID
Definition: GaudiHistos.h:2672
Histo1DMapID m_histo1DMapID
the actual storage/access of 1D histograms by unique ID
Definition: GaudiHistos.h:2800
int NumericID
type for internal numeric ID
Definition: GaudiHistoID.h:49
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:558
Histo3DMapTitle m_histo3DMapTitle
the actual storage/access of 3D histograms by unique title
Definition: GaudiHistos.h:2808
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
void setHistoOffSet(const HistoID::NumericID val)
set a value for histogram offset (property "HistoOffSet"
Definition: GaudiHistos.h:2685
const Histo3DMapTitle & histo3DMapTitle() const
get access to the map of all 3D histograms indexed via their title
Definition: GaudiHistos.h:2547
GaudiAlg::Histo3DMapTitle Histo3DMapTitle
the actual type for title->(3D histogram) mapping
Definition: GaudiHistos.h:73
bool histoExists(const HistoID &ID) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2382
GaudiAlg::Profile2DMapID Profile2DMapID
the actual type for (ID)->(2D profile histogram) mapping
Definition: GaudiHistos.h:81
GaudiAlg::Profile1DMapID Profile1DMapID
the actual type for (ID)->(1D profile histogram) mapping
Definition: GaudiHistos.h:76
bool splitHistoDir() const
get the flag for histogram path split (property "HistoSplitDir")
Definition: GaudiHistos.h:2399
const Profile2DMapTitle & profile2DMapTitle() const
get access to the map of all 2D profile histograms indexed via their title
Definition: GaudiHistos.h:2649
GaudiAlg::HistoBinEdges HistoBinEdges
Edges for variable binning.
Definition: GaudiHistos.h:86
Histo2DMapTitle m_histo2DMapTitle
the actual storage/access of 2D histograms by unique title
Definition: GaudiHistos.h:2803
GAUDI_API std::string header(const int ID=Default)
get the recommended header by enum
GaudiKernel.
Definition: Fill.h:8
void setProduceHistos(const bool val)
set the flag for histogram production (property "HistoProduce")
Definition: GaudiHistos.h:2677
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:2321
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:645
const Histo1DMapTitle & histo1DMapTitle() const
get access to the map of all 1D histograms indexed via their title
Definition: GaudiHistos.h:2446
GaudiAlg::Profile2DMapTitle Profile2DMapTitle
the actual type for title->(2D profile histogram) mapping
Definition: GaudiHistos.h:83
STL class.
void setCheckForNaN(const bool val)
set the flag for NaN checks (property "HistoCheckForNan")
Definition: GaudiHistos.h:2681
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:2285
Profile1DMapTitle m_profile1DMapTitle
the actual storage/access of 1D profile histograms by unique title
Definition: GaudiHistos.h:2813
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Definition of the basic interface.
Definition: IInterface.h:234
GAUDI_API std::string format(const int ID=Default)
get the format by enum
Simple helper class for description of 1D-histogram The class is targeted to act as the primary "hist...
Definition: HistoDef.h:30
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:193
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:469
const Histo1DMapID & histo1DMapID() const
get access to the map of all 1D histograms index via ID
Definition: GaudiHistos.h:2470
AIDA::IHistogram1D * histo(const std::string &title) const
access the EXISTING 1D histogram by title
Definition: GaudiHistos.h:2298
bool useNumericAutoIDs() const
Use old style sequencial numerical automatically assigned IDs ?
Definition: GaudiHistos.h:2413
GaudiAlg::Histo1DMapID Histo1DMapID
the actual type for (ID)->(1D histogram) mapping
Definition: GaudiHistos.h:61
const Profile1DMapTitle & profile1DMapTitle() const
get access to the map of all 1D profile histograms indexed via their title
Definition: GaudiHistos.h:2599
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
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:1862
Profile2DMapID m_profile2DMapID
the actual storage/access of 2D profile histograms by unique ID
Definition: GaudiHistos.h:2820
GaudiAlg::Histo2DMapTitle Histo2DMapTitle
the actual type for title->(2D histogram) mapping
Definition: GaudiHistos.h:68
void setSplitHistoDir(const bool val)
set the flag for histogram path split (property "HistoSplitDir")
Definition: GaudiHistos.h:2683
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:280
Histo1DMapTitle m_histo1DMapTitle
the actual storage/access of 1D histograms by unique title
Definition: GaudiHistos.h:2798
Profile2DMapTitle m_profile2DMapTitle
the actual storage/access of 2D profile histograms by unique title
Definition: GaudiHistos.h:2818
const Profile1DMapID & profile1DMapID() const
get access to the map of 1D profile histograms index via a ID
Definition: GaudiHistos.h:2622
bool histoCountersPrint() const
print histogram counters at finalization ?
Definition: GaudiHistos.h:2411
void setHistoTopDir(const std::string &val)
set top-level histogram directory (property "HistoTopDir")
Definition: GaudiHistos.h:2688
bool produceHistos() const
get the flag for histogram production (property "HistoProduce")
Definition: GaudiHistos.h:2393
GaudiAlg::Histo2DMapID Histo2DMapID
the actual type for (ID)->(2D histogram) mapping
Definition: GaudiHistos.h:66
Histo3DMapID m_histo3DMapID
the actual storage/access of 3D histograms by unique ID
Definition: GaudiHistos.h:2810
const std::string & histoDir() const
get histogram directory (property "HistoDir")
Definition: GaudiHistos.h:2405
Common class providing an architecture-independent hash map.
Definition: HashMap.h:77
const std::string & histoTopDir() const
get top-level histogram directory (property "HistoTopDir")
Definition: GaudiHistos.h:2403
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:394
const Histo2DMapID & histo2DMapID() const
get access to the map of 2D histograms index via ID
Definition: GaudiHistos.h:2520
Histo2DMapID m_histo2DMapID
the actual storage/access of 2D histograms by unique ID
Definition: GaudiHistos.h:2805
void setHistoDir(const std::string &val)
set histogram directory (property "HistoDir")
Definition: GaudiHistos.h:2691
Templated base class providing common histogramming methods for GaudiAlgorithm and GaudiTool like cla...
Definition: GaudiHistos.h:53
bool histoExists(const std::string &title) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2375
const Histo2DMapTitle & histo2DMapTitle() const
get access to the map of all 2D histograms indexed via their title
Definition: GaudiHistos.h:2497
#define GAUDI_API
Definition: Kernel.h:107
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
ID class for Histogram and Ntuples.
Definition: GaudiHistoID.h:44
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:2312
bool histosPrint() const
print histograms at finalization ?
Definition: GaudiHistos.h:2409
const Histo3DMapID & histo3DMapID() const
get access to the map of all 3D histograms index via a ID
Definition: GaudiHistos.h:2570
bool checkForNaN() const
get the flag for NaN checks (property "HistoCheckForNan")
Definition: GaudiHistos.h:2397