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 <limits>
18 #include <vector>
19 // ============================================================================
20 // GaudiKernel
21 // ============================================================================
23 // ============================================================================
24 // GaudiAlg
25 // ============================================================================
26 #include "GaudiAlg/Maps.h"
27 // ============================================================================
28 // Forward declarations
29 namespace AIDA
30 {
31  class IHistogram1D;
32  class IHistogram2D;
33  class IHistogram3D;
34  class IProfile1D;
35  class IProfile2D;
36 }
37 // ============================================================================
47 template <class PBASE>
48 class GAUDI_API GaudiHistos: public PBASE
49 {
50 public:
51  // ==========================================================================
54  // ==========================================================================
59  // ==========================================================================
64  // ==========================================================================
69  // ==========================================================================
74  // ==========================================================================
79  // ==========================================================================
82  // ==========================================================================
83 public:
84  // ==========================================================================
85  // ================================= 1D Histograms ==========================
86  // ================================= Fixed Binning ==========================
87  // ==========================================================================
130  AIDA::IHistogram1D* plot1D
131  ( const double value ,
132  const std::string& title ,
133  const double low ,
134  const double high ,
135  const unsigned long bins = 100 ,
136  const double weight = 1.0 ) const ;
137  // ==========================================================================
151  inline AIDA::IHistogram1D* plot
152  ( const double value ,
153  const std::string& title ,
154  const double low ,
155  const double high ,
156  const unsigned long bins = 100 ,
157  const double weight = 1.0 ) const
158  {
159  return plot1D ( value, title, low, high, bins, weight );
160  }
161  // ==========================================================================
186  AIDA::IHistogram1D* plot1D
187  ( const double value ,
188  const Gaudi::Histo1DDef& hdef ,
189  const double weight = 1.0 ) const ;
190  // ==========================================================================
201  inline AIDA::IHistogram1D* plot
202  ( const double value ,
203  const Gaudi::Histo1DDef& hdef ,
204  const double weight = 1.0 ) const
205  {
206  return plot1D ( value, hdef, weight );
207  }
208  // ==========================================================================
273  // ==========================================================================
274  AIDA::IHistogram1D* plot1D
275  ( const double value ,
276  const HistoID& ID ,
277  const std::string& title ,
278  const double low ,
279  const double high ,
280  const unsigned long bins = 100 ,
281  const double weight = 1.0 ) const ;
282  // ==========================================================================
297  inline AIDA::IHistogram1D* plot
298  ( const double value ,
299  const HistoID& ID ,
300  const std::string& title ,
301  const double low ,
302  const double high ,
303  const unsigned long bins = 100 ,
304  const double weight = 1.0 ) const
305  {
306  return plot1D ( value, ID, title, low, high, bins, weight );
307  }
308  // ==========================================================================
334  AIDA::IHistogram1D* plot1D
335  ( const double value ,
336  const HistoID& ID ,
337  const Gaudi::Histo1DDef& hdef ,
338  const double weight = 1.0 ) const ;
339  // ==========================================================================
351  inline AIDA::IHistogram1D* plot
352  ( const double value ,
353  const HistoID& ID ,
354  const Gaudi::Histo1DDef& hdef ,
355  const double weight = 1.0 ) const
356  {
357  return plot1D ( value, ID, hdef, weight );
358  }
422  template <class FUNCTION,class OBJECT>
423  inline AIDA::IHistogram1D* plot
424  ( const FUNCTION& func ,
425  OBJECT first ,
426  OBJECT last ,
427  const std::string& title ,
428  const double low ,
429  const double high ,
430  const unsigned long bins = 100 ) const
431  {
432  AIDA::IHistogram1D* h = nullptr;
433  if ( produceHistos() )
434  {
435  // retrieve or book the histogram
436  h = histo1D ( title ) ;
437  if ( !h ) { h = book1D ( title , low , high , bins ); }
438  // fill histogram
439  while( first != last && h )
440  { h = fill ( h , func( *first ) , 1.0 , title ) ; ++first ; }
441  }
442  return h ;
443  }
444  // ==========================================================================
500  template <class FUNCTION,class OBJECT>
501  inline AIDA::IHistogram1D* plot
502  ( const FUNCTION& func ,
503  OBJECT first ,
504  OBJECT last ,
505  const HistoID& ID ,
506  const std::string& title ,
507  const double low ,
508  const double high ,
509  const unsigned long bins = 100 ) const
510  {
511  AIDA::IHistogram1D* h(0);
512  if ( produceHistos() )
513  {
514  // retrieve or book the histogram
515  h = histo1D ( ID ) ;
516  if ( !h ) { h = book1D ( ID , title , low , high , bins ); }
517  // fill histogram
518  while( first != last && h )
519  { h = fill( h , func( *first ) , 1.0 , title ) ; ++first ; }
520  }
521  return h;
522  }
523  // ==========================================================================
592  template <class FUNCTION,class OBJECT,class WEIGHT>
593  inline AIDA::IHistogram1D* plot
594  ( const FUNCTION& func ,
595  OBJECT first ,
596  OBJECT last ,
597  const std::string& title ,
598  const double low ,
599  const double high ,
600  const unsigned long bins ,
601  const WEIGHT& weight ) const
602  {
603  AIDA::IHistogram1D* h = nullptr;
604  if ( produceHistos() )
605  {
606  // retrieve or book the histogram
607  h = histo1D ( title ) ;
608  if ( !h ) { h = book1D ( title , low , high , bins ); }
609  // fill histogram
610  while ( first != last && h )
611  { h = fill ( h ,
612  func ( *first ) ,
613  weight ( *first ) , title ) ; ++first ; }
614  }
615  return h;
616  }
617  // ==========================================================================
684  template <class FUNCTION,class OBJECT,class WEIGHT>
685  inline AIDA::IHistogram1D* plot
686  ( const FUNCTION& func ,
687  OBJECT first ,
688  OBJECT last ,
689  const HistoID& ID ,
690  const std::string& title ,
691  const double low ,
692  const double high ,
693  const unsigned long bins ,
694  const WEIGHT& weight ) const
695  {
696  AIDA::IHistogram1D* h = nullptr;
697  if ( produceHistos() )
698  {
699  // retrieve or book the histogram
700  h = histo1D ( ID ) ;
701  if ( !h ) { h = book1D ( ID , title , low , high , bins ); }
702  // fill histogram
703  while( first != last && h )
704  { h = fill ( h ,
705  func ( *first ) ,
706  weight ( *first ) , title ) ; ++first ; }
707  }
708  return h ;
709  }
710  // ==========================================================================
711  // ================================= 1D Histograms ==========================
712  // =============================== Variable Binning =========================
713  // ==========================================================================
753  AIDA::IHistogram1D* plot1D
754  ( const double value ,
755  const std::string& title ,
756  const HistoBinEdges& edges ,
757  const double weight = 1.0 ) const ;
758  // ==========================================================================
822  // ==========================================================================
823  AIDA::IHistogram1D* plot1D
824  ( const double value ,
825  const HistoID& ID ,
826  const std::string& title ,
827  const HistoBinEdges& edges ,
828  const double weight = 1.0 ) const ;
829  // ==========================================================================
830  // ================================= 2D Histograms ==========================
831  // ==========================================================================
882  AIDA::IHistogram2D* plot2D
883  ( const double valueX ,
884  const double valueY ,
885  const std::string& title ,
886  const double lowX ,
887  const double highX ,
888  const double lowY ,
889  const double highY ,
890  const unsigned long binsX = 50 ,
891  const unsigned long binsY = 50 ,
892  const double weight = 1.0 ) const;
893  // ==========================================================================
970  AIDA::IHistogram2D* plot2D
971  ( const double valueX ,
972  const double valueY ,
973  const HistoID& ID ,
974  const std::string& title ,
975  const double lowX ,
976  const double highX ,
977  const double lowY ,
978  const double highY ,
979  const unsigned long binsX = 50 ,
980  const unsigned long binsY = 50 ,
981  const double weight = 1.0 ) const;
982  // ==========================================================================
983  // ================================= 2D Histograms ==========================
984  // =============================== Variable Binning =========================
985  // ==========================================================================
1031  AIDA::IHistogram2D* plot2D
1032  ( const double valueX ,
1033  const double valueY ,
1034  const std::string& title ,
1035  const HistoBinEdges& edgesX ,
1036  const HistoBinEdges& edgesY ,
1037  const double weight = 1.0 ) const ;
1038  // ==========================================================================
1114  AIDA::IHistogram2D* plot2D
1115  ( const double valueX ,
1116  const double valueY ,
1117  const HistoID& ID ,
1118  const std::string& title ,
1119  const HistoBinEdges& edgesX ,
1120  const HistoBinEdges& edgesY ,
1121  const double weight = 1.0 ) const ;
1122  // ==========================================================================
1123  // ================================= 3D Histograms ==========================
1124  // ==========================================================================
1183  AIDA::IHistogram3D* plot3D
1184  ( const double valueX ,
1185  const double valueY ,
1186  const double valueZ ,
1187  const std::string& title ,
1188  const double lowX ,
1189  const double highX ,
1190  const double lowY ,
1191  const double highY ,
1192  const double lowZ ,
1193  const double highZ ,
1194  const unsigned long binsX = 10 ,
1195  const unsigned long binsY = 10 ,
1196  const unsigned long binsZ = 10 ,
1197  const double weight = 1.0 ) const;
1198  // ==========================================================================
1285  AIDA::IHistogram3D* plot3D
1286  ( const double valueX ,
1287  const double valueY ,
1288  const double valueZ ,
1289  const HistoID& ID ,
1290  const std::string& title ,
1291  const double lowX ,
1292  const double highX ,
1293  const double lowY ,
1294  const double highY ,
1295  const double lowZ ,
1296  const double highZ ,
1297  const unsigned long binsX = 10 ,
1298  const unsigned long binsY = 10 ,
1299  const unsigned long binsZ = 10 ,
1300  const double weight = 1.0 ) const;
1301  // ==========================================================================
1302  // ================================= 3D Histograms ==========================
1303  // =============================== Variable Binning =========================
1304  // ==========================================================================
1352  AIDA::IHistogram3D* plot3D
1353  ( const double valueX ,
1354  const double valueY ,
1355  const double valueZ ,
1356  const std::string& title ,
1357  const HistoBinEdges& edgesX ,
1358  const HistoBinEdges& edgesY ,
1359  const HistoBinEdges& edgesZ ,
1360  const double weight = 1.0 ) const ;
1361  // ==========================================================================
1362  // ==========================================================================
1447  AIDA::IHistogram3D* plot3D
1448  ( const double valueX ,
1449  const double valueY ,
1450  const double valueZ ,
1451  const HistoID& ID ,
1452  const std::string& title ,
1453  const HistoBinEdges& edgesX ,
1454  const HistoBinEdges& edgesY ,
1455  const HistoBinEdges& edgesZ ,
1456  const double weight = 1.0 ) const ;
1457  // ==========================================================================
1458  // ================================= 1D Profile =============================
1459  // ================================= Fixed binning ==========================
1460  // ==========================================================================
1509  AIDA::IProfile1D* profile1D
1510  ( const double valueX ,
1511  const double valueY ,
1512  const std::string& title ,
1513  const double lowX ,
1514  const double highX ,
1515  const unsigned long binsX = 100 ,
1516  const std::string& opt = "" ,
1517  const double lowY = -std::numeric_limits<double>::max() ,
1518  const double highY = std::numeric_limits<double>::max() ,
1519  const double weight = 1.0 ) const ;
1520  // ==========================================================================
1586  AIDA::IProfile1D* profile1D
1587  ( const double valueX ,
1588  const double valueY ,
1589  const HistoID& ID ,
1590  const std::string& title ,
1591  const double lowX ,
1592  const double highX ,
1593  const unsigned long binsX = 100 ,
1594  const std::string& opt = "" ,
1595  const double lowY = -std::numeric_limits<double>::max() ,
1596  const double highY = std::numeric_limits<double>::max() ,
1597  const double weight = 1.0 ) const;
1598  // ==========================================================================
1599  // ================================= 1D Profile =============================
1600  // ============================== Variable binning ==========================
1601  // ==========================================================================
1644  AIDA::IProfile1D* profile1D
1645  ( const double valueX ,
1646  const double valueY ,
1647  const std::string& title ,
1648  const HistoBinEdges& edges ,
1649  const double weight = 1.0 ) const ;
1650  // ==========================================================================
1712  AIDA::IProfile1D* profile1D
1713  ( const double valueX ,
1714  const double valueY ,
1715  const HistoID& ID ,
1716  const std::string& title ,
1717  const HistoBinEdges& edges ,
1718  const double weight = 1.0 ) const;
1719  // ==========================================================================
1720  // ================================= 2D Profile =============================
1721  // ==========================================================================
1772  AIDA::IProfile2D* profile2D
1773  ( const double valueX ,
1774  const double valueY ,
1775  const double valueZ ,
1776  const std::string& title ,
1777  const double lowX ,
1778  const double highX ,
1779  const double lowY ,
1780  const double highY ,
1781  const unsigned long binsX = 50 ,
1782  const unsigned long binsY = 50 ,
1783  const double weight = 1.0 ) const;
1784  // ==========================================================================
1852  AIDA::IProfile2D* profile2D
1853  ( const double valueX ,
1854  const double valueY ,
1855  const double valueZ ,
1856  const HistoID& ID ,
1857  const std::string& title ,
1858  const double lowX ,
1859  const double highX ,
1860  const double lowY ,
1861  const double highY ,
1862  const unsigned long binsX = 50 ,
1863  const unsigned long binsY = 50 ,
1864  const double weight = 1.0 ) const;
1865  // ==========================================================================
1866  // ================================= 2D Profile =============================
1867  // ============================== Variable binning ==========================
1868  // ==========================================================================
1914  AIDA::IProfile2D* profile2D
1915  ( const double valueX ,
1916  const double valueY ,
1917  const double valueZ ,
1918  const std::string& title ,
1919  const HistoBinEdges& edgesX ,
1920  const HistoBinEdges& edgesY ,
1921  const double weight = 1.0 ) const ;
1922  // ==========================================================================
1985  AIDA::IProfile2D* profile2D
1986  ( const double valueX ,
1987  const double valueY ,
1988  const double valueZ ,
1989  const HistoID& ID ,
1990  const std::string& title ,
1991  const HistoBinEdges& edgesX ,
1992  const HistoBinEdges& edgesY ,
1993  const double weight = 1.0 ) const;
1994  // ==========================================================================
1995 
1996 public: // 1D Fixed
1997 
1998  // ==========================================================================
2010  AIDA::IHistogram1D* book1D
2011  ( const std::string& title ,
2012  const double low = 0 ,
2013  const double high = 100 ,
2014  const unsigned long bins = 100 ) const ;
2015  // ==========================================================================
2028  inline AIDA::IHistogram1D* book
2029  ( const std::string& title ,
2030  const double low = 0 ,
2031  const double high = 100 ,
2032  const unsigned long bins = 100 ) const
2033  {
2034  return book1D( title, low, high, bins );
2035  }
2036  // ==========================================================================
2045  AIDA::IHistogram1D* book
2046  ( const Gaudi::Histo1DDef& hdef ) const ;
2047  // ==========================================================================
2058  AIDA::IHistogram1D* book1D
2059  ( const HistoID& ID ,
2060  const std::string& title ,
2061  const double low = 0 ,
2062  const double high = 100 ,
2063  const unsigned long bins = 100 ) const ;
2064  // ==========================================================================
2078  inline AIDA::IHistogram1D* book
2079  ( const HistoID& ID ,
2080  const std::string& title ,
2081  const double low = 0 ,
2082  const double high = 100 ,
2083  const unsigned long bins = 100 ) const
2084  {
2085  return book1D( ID, title, low, high, bins );
2086  }
2087  // ==========================================================================
2095  inline AIDA::IHistogram1D* book
2096  ( const HistoID& ID ,
2097  const Gaudi::Histo1DDef& hdef ) const ;
2098  // ==========================================================================
2099 
2100 public: // 1D Variable
2101 
2102  // ==========================================================================
2113  AIDA::IHistogram1D* book1D
2114  ( const std::string& title ,
2115  const HistoBinEdges& edges ) const ;
2116  // ==========================================================================
2126  AIDA::IHistogram1D* book1D
2127  ( const HistoID& ID ,
2128  const std::string& title ,
2129  const HistoBinEdges& edges ) const ;
2130  // ==========================================================================
2131 
2132 public: // 2D Fixed
2133 
2134  // ==========================================================================
2149  AIDA::IHistogram2D* book2D
2150  ( const std::string& title ,
2151  const double lowX = 0 ,
2152  const double highX = 100 ,
2153  const unsigned long binsX = 50 ,
2154  const double lowY = 0 ,
2155  const double highY = 100 ,
2156  const unsigned long binsY = 50 ) const ;
2157  // ==========================================================================
2168  AIDA::IHistogram2D* book2D
2169  ( const HistoID& ID ,
2170  const std::string& title ,
2171  const double lowX = 0 ,
2172  const double highX = 100 ,
2173  const unsigned long binsX = 50 ,
2174  const double lowY = 0 ,
2175  const double highY = 100 ,
2176  const unsigned long binsY = 50 ) const ;
2177  // ==========================================================================
2178 
2179 public: // 2D Variable
2180 
2181  // ==========================================================================
2193  AIDA::IHistogram2D * book2D
2194  ( const std::string& title ,
2195  const HistoBinEdges& edgesX ,
2196  const HistoBinEdges& edgesY ) const ;
2197  // ==========================================================================
2208  AIDA::IHistogram2D * book2D
2209  ( const HistoID& ID ,
2210  const std::string& title ,
2211  const HistoBinEdges& edgesX ,
2212  const HistoBinEdges& edgesY ) const ;
2213  // ==========================================================================
2214 
2215 public: // 3D Fixed
2216 
2217  // ==========================================================================
2235  AIDA::IHistogram3D* book3D
2236  ( const std::string& title ,
2237  const double lowX = 0 ,
2238  const double highX = 100 ,
2239  const unsigned long binsX = 10 ,
2240  const double lowY = 0 ,
2241  const double highY = 100 ,
2242  const unsigned long binsY = 10 ,
2243  const double lowZ = 0 ,
2244  const double highZ = 100 ,
2245  const unsigned long binsZ = 10 ) const ;
2246  // ==========================================================================
2263  AIDA::IHistogram3D* book3D
2264  ( const HistoID& ID ,
2265  const std::string& title ,
2266  const double lowX = 0 ,
2267  const double highX = 100 ,
2268  const unsigned long binsX = 10 ,
2269  const double lowY = 0 ,
2270  const double highY = 100 ,
2271  const unsigned long binsY = 10 ,
2272  const double lowZ = 0 ,
2273  const double highZ = 100 ,
2274  const unsigned long binsZ = 10 ) const ;
2275  // ==========================================================================
2276 
2277 public: // 3D Variable
2278 
2279  // ==========================================================================
2292  AIDA::IHistogram3D * book3D
2293  ( const std::string& title ,
2294  const HistoBinEdges& edgesX ,
2295  const HistoBinEdges& edgesY ,
2296  const HistoBinEdges& edgesZ ) const ;
2297  // ==========================================================================
2309  AIDA::IHistogram3D * book3D
2310  ( const HistoID& ID ,
2311  const std::string& title ,
2312  const HistoBinEdges& edgesX ,
2313  const HistoBinEdges& edgesY ,
2314  const HistoBinEdges& edgesZ ) const ;
2315  // ==========================================================================
2316 
2317 public: // 1D Fixed Profiles
2318 
2319  // ==========================================================================
2334  AIDA::IProfile1D* bookProfile1D
2335  ( const std::string& title ,
2336  const double low = 0 ,
2337  const double high = 100 ,
2338  const unsigned long bins = 100 ,
2339  const std::string& opt = "" ,
2340  const double lowY = -std::numeric_limits<double>::max() ,
2341  const double highY = std::numeric_limits<double>::max() ) const;
2342  // ==========================================================================
2358  AIDA::IProfile1D* bookProfile1D
2359  ( const HistoID& ID ,
2360  const std::string& title ,
2361  const double low = 0 ,
2362  const double high = 100 ,
2363  const unsigned long bins = 100 ,
2364  const std::string& opt = "" ,
2365  const double lowY = -std::numeric_limits<double>::max() ,
2366  const double highY = std::numeric_limits<double>::max() ) const;
2367  // ==========================================================================
2368 
2369 public: // 1D Variable Profiles
2370 
2371  // ==========================================================================
2381  AIDA::IProfile1D* bookProfile1D
2382  ( const std::string& title ,
2383  const HistoBinEdges& edges ) const;
2384  // ==========================================================================
2394  AIDA::IProfile1D* bookProfile1D
2395  ( const HistoID& ID ,
2396  const std::string& title ,
2397  const HistoBinEdges& edges ) const;
2398  // ==========================================================================
2399 
2400 public: // 2D Profiles
2401 
2402  // ==========================================================================
2417  AIDA::IProfile2D* bookProfile2D
2418  ( const std::string& title ,
2419  const double lowX = 0 ,
2420  const double highX = 100 ,
2421  const unsigned long binsX = 50 ,
2422  const double lowY = 0 ,
2423  const double highY = 100 ,
2424  const unsigned long binsY = 50 ) const ;
2425  // ==========================================================================
2439  AIDA::IProfile2D* bookProfile2D
2440  ( const HistoID& ID ,
2441  const std::string& title ,
2442  const double lowX = 0 ,
2443  const double highX = 100 ,
2444  const unsigned long binsX = 50 ,
2445  const double lowY = 0 ,
2446  const double highY = 100 ,
2447  const unsigned long binsY = 50 ) const ;
2448  // ==========================================================================
2449 
2450 public: // 2D Profiles
2451 
2452  // ==========================================================================
2463  AIDA::IProfile2D* bookProfile2D
2464  ( const std::string& title ,
2465  const HistoBinEdges& edgesX,
2466  const HistoBinEdges& edgesY ) const ;
2467  // ==========================================================================
2477  AIDA::IProfile2D* bookProfile2D
2478  ( const HistoID& ID ,
2479  const std::string& title ,
2480  const HistoBinEdges& edgesX,
2481  const HistoBinEdges& edgesY ) const ;
2482  // ==========================================================================
2483 
2484 public:
2485 
2486  // ==========================================================================
2494  AIDA::IHistogram1D* fill
2495  ( AIDA::IHistogram1D* histo ,
2496  const double value ,
2497  const double weight ,
2498  const std::string& title = "" ) const ;
2499  // ==========================================================================
2508  AIDA::IHistogram2D* fill
2509  ( AIDA::IHistogram2D* histo ,
2510  const double valueX ,
2511  const double valueY ,
2512  const double weight ,
2513  const std::string& title = "" ) const ;
2514  // ==========================================================================
2524  AIDA::IHistogram3D* fill
2525  ( AIDA::IHistogram3D* histo ,
2526  const double valueX ,
2527  const double valueY ,
2528  const double valueZ ,
2529  const double weight ,
2530  const std::string& title = "" ) const ;
2531  // ==========================================================================
2540  AIDA::IProfile1D* fill
2541  ( AIDA::IProfile1D* histo ,
2542  const double valueX ,
2543  const double valueY ,
2544  const double weight ,
2545  const std::string& title = "" ) const ;
2546  // ==========================================================================
2556  AIDA::IProfile2D* fill
2557  ( AIDA::IProfile2D* histo ,
2558  const double valueX ,
2559  const double valueY ,
2560  const double valueZ ,
2561  const double weight ,
2562  const std::string& title = "" ) const ;
2563  // ==========================================================================
2564 public:
2565  // ==========================================================================
2569  inline AIDA::IHistogram1D* histo1D ( const std::string& title ) const
2570  {
2571  auto found = histo1DMapTitle().find( title ) ;
2572  return found != histo1DMapTitle().end() ? found->second : nullptr;
2573  }
2574  // ==========================================================================
2582  inline AIDA::IHistogram1D* histo ( const std::string& title ) const
2583  {
2584  return histo1D( title );
2585  }
2586  // ==========================================================================
2590  inline AIDA::IHistogram2D* histo2D ( const std::string& title ) const
2591  {
2592  auto found = histo2DMapTitle().find( title ) ;
2593  return histo2DMapTitle().end() != found ? found->second : nullptr;
2594  }
2595  // ==========================================================================
2599  inline AIDA::IHistogram3D* histo3D ( const std::string& title ) const
2600  {
2601  auto found = histo3DMapTitle().find( title ) ;
2602  return histo3DMapTitle().end() != found ? found->second : nullptr;
2603  }
2604  // ==========================================================================
2608  inline AIDA::IProfile1D* profile1D ( const std::string& title ) const
2609  {
2610  auto found = profile1DMapTitle().find( title ) ;
2611  return profile1DMapTitle().end() != found ? found->second : nullptr;
2612  }
2613  // ==========================================================================
2617  inline AIDA::IProfile2D* profile2D ( const std::string& title ) const
2618  {
2619  auto found = profile2DMapTitle().find( title ) ;
2620  return profile2DMapTitle().end() != found ? found->second : nullptr;
2621  }
2622  // ==========================================================================
2623 public:
2624  // ==========================================================================
2628  AIDA::IHistogram1D* histo1D ( const HistoID& ID ) const;
2629  // ==========================================================================
2637  inline AIDA::IHistogram1D* histo ( const HistoID& ID ) const
2638  {
2639  return histo1D( ID );
2640  }
2641  // ==========================================================================
2645  AIDA::IHistogram2D* histo2D ( const HistoID& ID ) const;
2646  // ==========================================================================
2650  AIDA::IHistogram3D* histo3D ( const HistoID& ID ) const;
2651  // ==========================================================================
2655  AIDA::IProfile1D* profile1D ( const HistoID& ID ) const;
2656  // ==========================================================================
2660  AIDA::IProfile2D* profile2D ( const HistoID& ID ) const;
2661  // ==========================================================================
2662 public:
2663  // ==========================================================================
2665  inline bool histoExists ( const std::string& title ) const
2666  {
2667  return
2668  ( 0 != histo ( title ) ||
2669  0 != histo2D ( title ) ||
2670  0 != histo3D ( title ) ||
2671  0 != profile1D ( title ) ||
2672  0 != profile2D ( title ) );
2673  }
2674  // ==========================================================================
2676  inline bool histoExists ( const HistoID& ID ) const
2677  {
2678  return
2679  ( 0 != histo ( ID ) ||
2680  0 != histo2D ( ID ) ||
2681  0 != histo3D ( ID ) ||
2682  0 != profile1D ( ID ) ||
2683  0 != profile2D ( ID ) );
2684  }
2686  unsigned int totalNumberOfHistos() const;
2687  // ==========================================================================
2688 public: // trivial & non-trivial accessors
2689  // ==========================================================================
2691  inline bool produceHistos () const { return m_produceHistos ; }
2693  inline bool fullDetail () const { return m_fullDetail ; }
2695  inline bool checkForNaN () const { return m_checkForNaN ; }
2697  inline bool splitHistoDir () const { return m_splitHistoDir ; }
2699  inline HistoID::NumericID histoOffSet () const { return m_histoOffSet ; }
2701  inline const std::string& histoTopDir () const { return m_histoTopDir ; }
2703  inline const std::string& histoDir () const { return m_histoDir ; }
2705  std::string histoPath () const;
2707  inline bool histosPrint () const { return m_histosPrint ; }
2709  inline bool histoCountersPrint () const { return m_histoCountersPrint ; }
2711  inline bool useNumericAutoIDs() const { return m_useNumericAutoIDs; }
2712  // ==========================================================================
2717  int printHistos ( const MSG::Level level = MSG::ALWAYS ) const ;
2718  // ==========================================================================
2744  const Histo1DMapTitle & histo1DMapTitle() const { return m_histo1DMapTitle; }
2745  // ==========================================================================
2768  const Histo1DMapID & histo1DMapID () const { return m_histo1DMapID ; }
2769  // ==========================================================================
2795  const Histo2DMapTitle & histo2DMapTitle() const { return m_histo2DMapTitle ; }
2796  // ==========================================================================
2818  const Histo2DMapID& histo2DMapID () const { return m_histo2DMapID ; }
2819  // ==========================================================================
2845  const Histo3DMapTitle & histo3DMapTitle () const { return m_histo3DMapTitle ; }
2846  // ==========================================================================
2868  const Histo3DMapID & histo3DMapID () const { return m_histo3DMapID; }
2869  // ==========================================================================
2897  const Profile1DMapTitle & profile1DMapTitle() const { return m_profile1DMapTitle; }
2898  // ==========================================================================
2920  const Profile1DMapID & profile1DMapID () const { return m_profile1DMapID; }
2921  // ==========================================================================
2947  const Profile2DMapTitle & profile2DMapTitle() const { return m_profile2DMapTitle; }
2948  // ==========================================================================
2970  const Profile2DMapID & profile2DMapID () const { return m_profile2DMapID; }
2971  // ==========================================================================
2972 public: // trivial setters
2973  // ==========================================================================
2975  inline void setProduceHistos ( const bool val ) { m_produceHistos = val ; }
2977  inline void setFullDetail ( const bool val ) { m_fullDetail = val ; }
2979  inline void setCheckForNaN ( const bool val ) { m_checkForNaN = val ; }
2981  inline void setSplitHistoDir ( const bool val ) { m_splitHistoDir = val ; }
2983  inline void setHistoOffSet ( const HistoID::NumericID val )
2984  { m_histoOffSet = val ; }
2985  // ==========================================================================
2987  inline void setHistoTopDir ( const std::string& val ) { m_histoTopDir = val ; }
2988  // ==========================================================================
2990  inline void setHistoDir ( const std::string& val ) { m_histoDir = val ; }
2991  // ==========================================================================
2992 public:
2993  // ==========================================================================
2995  GaudiHistos ( const std::string & name,
2996  ISvcLocator * pSvcLocator );
2997  // ==========================================================================
2999  GaudiHistos ( const std::string& type ,
3000  const std::string& name ,
3001  const IInterface* parent );
3002  // ==========================================================================
3004  ~GaudiHistos() override = default;
3005  // ==========================================================================
3006 protected:
3007  // ==========================================================================
3011  StatusCode initialize() override
3012 #ifdef __ICC
3013  { return i_ghInitialize(); }
3014  StatusCode i_ghInitialize()
3015 #endif
3016  ;
3017  // ==========================================================================
3021  StatusCode finalize() override
3022 #ifdef __ICC
3023  { return i_ghFinalize(); }
3024  StatusCode i_ghFinalize()
3025 #endif
3026  ;
3027  // ==========================================================================
3028 private:
3029  // ==========================================================================
3031  bool noHistos() const;
3032  // ===========================================unsigned===============================
3034  void initGaudiHistosConstructor();
3035  // ==========================================================================
3041  void monitorHisto( const AIDA::IBaseHistogram* hist,
3042  const HistoID& ID ) const;
3043  // ==========================================================================
3048  void newHistoID( const std::string & title,
3049  HistoID& ID ) const;
3050  // ==========================================================================
3051 protected:
3052  // ==========================================================================
3054  std::string convertTitleToID( std::string title ) const;
3055  // ==========================================================================
3056 private:
3057  // ==========================================================================
3059  void printHistoHandler ( Property& /* theProp */ ) ; // "HistoPrint"
3060  // ==========================================================================
3061 private:
3062  // ==========================================================================
3072  HistoID::NumericID m_histoOffSet ;
3083  // ==========================================================================
3085  mutable Histo1DMapTitle m_histo1DMapTitle ;
3087  mutable Histo1DMapID m_histo1DMapID ;
3088  // ==========================================================================
3090  mutable Histo2DMapTitle m_histo2DMapTitle ;
3092  mutable Histo2DMapID m_histo2DMapID ;
3093  // ==========================================================================
3095  mutable Histo3DMapTitle m_histo3DMapTitle ;
3097  mutable Histo3DMapID m_histo3DMapID ;
3098  // ==========================================================================
3100  mutable Profile1DMapTitle m_profile1DMapTitle ;
3102  mutable Profile1DMapID m_profile1DMapID ;
3103  // ==========================================================================
3105  mutable Profile2DMapTitle m_profile2DMapTitle ;
3107  mutable Profile2DMapID m_profile2DMapID ;
3108  // ==========================================================================
3121  // ==========================================================================
3122 };
3123 // ============================================================================
3124 // The END
3125 // ============================================================================
3126 #endif // GAUDIALG_GAUDIHISTOS_H
3127 // ============================================================================
void setFullDetail(const bool val)
set flag to control output level of histograms
Definition: GaudiHistos.h:2977
HistoID::NumericID histoOffSet() const
get the value for histogram offset (property "HistoOffSet")
Definition: GaudiHistos.h:2699
bool fullDetail() const
get flag to control output level of histograms
Definition: GaudiHistos.h:2693
GaudiAlg::Histo3DMapID Histo3DMapID
the actual type for (ID)->(3D histogram) mapping
Definition: GaudiHistos.h:66
bool m_declareMoniHists
Flag to turn on/off the registration of histograms to the Monitoring Service.
Definition: GaudiHistos.h:3082
GaudiAlg::Histo1DMapTitle Histo1DMapTitle
the actual type for title->(1D histogram) mapping
Definition: GaudiHistos.h:58
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:2590
def initialize()
Definition: AnalysisTest.py:12
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:2617
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:3102
GaudiAlg::Profile1DMapTitle Profile1DMapTitle
the actual type for title->(1D profile histogram) mapping
Definition: GaudiHistos.h:73
GaudiAlg::HistoID HistoID
the actual type for histogram identifier
Definition: GaudiHistos.h:53
AIDA::IHistogram1D * histo(const HistoID &ID) const
access the EXISTING 1D histogram by ID
Definition: GaudiHistos.h:2637
const Profile2DMapID & profile2DMapID() const
get access to the map of 2D profile histograms index via a ID
Definition: GaudiHistos.h:2970
Histo1DMapID m_histo1DMapID
the actual storage/access of 1D histograms by unique ID
Definition: GaudiHistos.h:3087
std::string m_histoTopDir
histogram top level directory
Definition: GaudiHistos.h:3074
Histo3DMapTitle m_histo3DMapTitle
the actual storage/access of 3D histograms by unique title
Definition: GaudiHistos.h:3095
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:2983
const Histo3DMapTitle & histo3DMapTitle() const
get access to the map of all 3D histograms indexed via their title
Definition: GaudiHistos.h:2845
GaudiAlg::Histo3DMapTitle Histo3DMapTitle
the actual type for title->(3D histogram) mapping
Definition: GaudiHistos.h:68
bool histoExists(const HistoID &ID) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2676
GaudiAlg::Profile2DMapID Profile2DMapID
the actual type for (ID)->(2D profile histogram) mapping
Definition: GaudiHistos.h:76
std::string m_histo1DTableFormat
format for printout of 1D-histograms as a table
Definition: GaudiHistos.h:3110
GaudiAlg::Profile1DMapID Profile1DMapID
the actual type for (ID)->(1D profile histogram) mapping
Definition: GaudiHistos.h:71
bool splitHistoDir() const
get the flag for histogram path split (property "HistoSplitDir")
Definition: GaudiHistos.h:2697
const Profile2DMapTitle & profile2DMapTitle() const
get access to the map of all 2D profile histograms indexed via their title
Definition: GaudiHistos.h:2947
GaudiAlg::HistoBinEdges HistoBinEdges
Edges for variable binning.
Definition: GaudiHistos.h:81
Histo2DMapTitle m_histo2DMapTitle
the actual storage/access of 2D histograms by unique title
Definition: GaudiHistos.h:3090
GaudiKernel.
Definition: Fill.h:8
void setProduceHistos(const bool val)
set the flag for histogram production (property "HistoProduce")
Definition: GaudiHistos.h:2975
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:2608
const Histo1DMapTitle & histo1DMapTitle() const
get access to the map of all 1D histograms indexed via their title
Definition: GaudiHistos.h:2744
GaudiAlg::Profile2DMapTitle Profile2DMapTitle
the actual type for title->(2D profile histogram) mapping
Definition: GaudiHistos.h:78
STL class.
void setCheckForNaN(const bool val)
set the flag for NaN checks (property "HistoCheckForNan")
Definition: GaudiHistos.h:2979
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:2569
Profile1DMapTitle m_profile1DMapTitle
the actual storage/access of 1D profile histograms by unique title
Definition: GaudiHistos.h:3100
string type
Definition: gaudirun.py:151
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
HistoID::NumericID m_histoOffSet
general histogram ID offset (only works for automatically assigned numeric IDs)
Definition: GaudiHistos.h:3072
Definition of the basic interface.
Definition: IInterface.h:234
Simple helper class for description of 1D-histogram The class is targeted to act as the primary "hist...
Definition: HistoDef.h:30
bool m_histoCountersPrint
print histogram counters at finalization
Definition: GaudiHistos.h:3080
const Histo1DMapID & histo1DMapID() const
get access to the map of all 1D histograms index via ID
Definition: GaudiHistos.h:2768
AIDA::IHistogram1D * histo(const std::string &title) const
access the EXISTING 1D histogram by title
Definition: GaudiHistos.h:2582
bool useNumericAutoIDs() const
Use old style sequencial numerical automatically assigned IDs ?
Definition: GaudiHistos.h:2711
GaudiAlg::Histo1DMapID Histo1DMapID
the actual type for (ID)->(1D histogram) mapping
Definition: GaudiHistos.h:56
const Profile1DMapTitle & profile1DMapTitle() const
get access to the map of all 1D profile histograms indexed via their title
Definition: GaudiHistos.h:2897
string opt
print 'Summary: %32s [s] d d steps'%(summary.protocol,summary.type,summary.nevt,len(summary.data),)
Definition: ana.py:116
std::string m_histo1DTableFormatShort
format for printout of 1D-histograms as a table
Definition: GaudiHistos.h:3112
bool m_splitHistoDir
split histogram directory name (very useful for Hbook)
Definition: GaudiHistos.h:3070
Profile2DMapID m_profile2DMapID
the actual storage/access of 2D profile histograms by unique ID
Definition: GaudiHistos.h:3107
GaudiAlg::Histo2DMapTitle Histo2DMapTitle
the actual type for title->(2D histogram) mapping
Definition: GaudiHistos.h:63
void setSplitHistoDir(const bool val)
set the flag for histogram path split (property "HistoSplitDir")
Definition: GaudiHistos.h:2981
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
Histo1DMapTitle m_histo1DMapTitle
the actual storage/access of 1D histograms by unique title
Definition: GaudiHistos.h:3085
Profile2DMapTitle m_profile2DMapTitle
the actual storage/access of 2D profile histograms by unique title
Definition: GaudiHistos.h:3105
const Profile1DMapID & profile1DMapID() const
get access to the map of 1D profile histograms index via a ID
Definition: GaudiHistos.h:2920
bool histoCountersPrint() const
print histogram counters at finalization ?
Definition: GaudiHistos.h:2709
void setHistoTopDir(const std::string &val)
set top-level histogram directory (property "HistoTopDir")
Definition: GaudiHistos.h:2987
bool produceHistos() const
get the flag for histogram production (property "HistoProduce")
Definition: GaudiHistos.h:2691
GaudiAlg::Histo2DMapID Histo2DMapID
the actual type for (ID)->(2D histogram) mapping
Definition: GaudiHistos.h:61
Histo3DMapID m_histo3DMapID
the actual storage/access of 3D histograms by unique ID
Definition: GaudiHistos.h:3097
const std::string & histoDir() const
get histogram directory (property "HistoDir")
Definition: GaudiHistos.h:2703
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:2701
const Histo2DMapID & histo2DMapID() const
get access to the map of 2D histograms index via ID
Definition: GaudiHistos.h:2818
Histo2DMapID m_histo2DMapID
the actual storage/access of 2D histograms by unique ID
Definition: GaudiHistos.h:3092
void setHistoDir(const std::string &val)
set histogram directory (property "HistoDir")
Definition: GaudiHistos.h:2990
Templated base class providing common histogramming methods for GaudiAlgorithm and GaudiTool like cla...
Definition: GaudiHistos.h:48
std::string m_histoDir
histogram directory
Definition: GaudiHistos.h:3076
std::map< std::string, std::string > m_idReplaceInfo
Map of strings to search and replace when using the title as the basis of automatically generated lit...
Definition: GaudiHistos.h:3120
bool m_produceHistos
flag to SWITCH ON/SWITCH OFF the histogrm fillling and booking
Definition: GaudiHistos.h:3064
bool histoExists(const std::string &title) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2665
const Histo2DMapTitle & histo2DMapTitle() const
get access to the map of all 2D histograms indexed via their title
Definition: GaudiHistos.h:2795
#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
std::string m_histo1DTableHeader
the header for the table of 1-D historgrams
Definition: GaudiHistos.h:3114
bool m_useNumericAutoIDs
Flag to switch back to the old style sequencial numerical automatic IDs.
Definition: GaudiHistos.h:3116
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:2599
bool m_checkForNaN
flag to control check for Nan/Finite while filling the histogram
Definition: GaudiHistos.h:3068
bool histosPrint() const
print histograms at finalization ?
Definition: GaudiHistos.h:2707
bool m_fullDetail
flag to control output level of histograms
Definition: GaudiHistos.h:3066
const Histo3DMapID & histo3DMapID() const
get access to the map of all 3D histograms index via a ID
Definition: GaudiHistos.h:2868
bool checkForNaN() const
get the flag for NaN checks (property "HistoCheckForNan")
Definition: GaudiHistos.h:2695
bool m_histosPrint
print histograms at finalization
Definition: GaudiHistos.h:3078