All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiHistos.h
Go to the documentation of this file.
1 // $Id: GaudiHistos.h,v 1.11 2008/10/27 19:22:20 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDIALG_GAUDIHISTOS_H
4 #define GAUDIALG_GAUDIHISTOS_H 1
5 // ============================================================================
6 /* @file GaudiHistos.h
7  *
8  * Header file for class : GaudiHistos
9  *
10  * @author Chris Jones Christopher.Rob.Jones@cern.ch
11  * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
12  * @date 2005-08-08
13  */
14 // ============================================================================
15 // Include files#
16 // ============================================================================
17 // STD& STL
18 // ============================================================================
19 #include <limits>
20 #include <vector>
21 // ============================================================================
22 // GaudiKernel
23 // ============================================================================
25 // ============================================================================
26 // GaudiAlg
27 // ============================================================================
28 #include "GaudiAlg/Maps.h"
29 // ============================================================================
30 // Forward declarations
31 namespace AIDA
32 {
33  class IHistogram1D;
34  class IHistogram2D;
35  class IHistogram3D;
36  class IProfile1D;
37  class IProfile2D;
38 }
39 // ============================================================================
49 template <class PBASE>
50 class GAUDI_API GaudiHistos: public PBASE
51 {
52 public:
53  // ==========================================================================
56  // ==========================================================================
61  // ==========================================================================
66  // ==========================================================================
71  // ==========================================================================
76  // ==========================================================================
81  // ==========================================================================
84  // ==========================================================================
85 public:
86  // ==========================================================================
87  // ================================= 1D Histograms ==========================
88  // ================================= Fixed Binning ==========================
89  // ==========================================================================
132  AIDA::IHistogram1D* plot1D
133  ( const double value ,
134  const std::string& title ,
135  const double low ,
136  const double high ,
137  const unsigned long bins = 100 ,
138  const double weight = 1.0 ) const ;
139  // ==========================================================================
153  inline AIDA::IHistogram1D* plot
154  ( const double value ,
155  const std::string& title ,
156  const double low ,
157  const double high ,
158  const unsigned long bins = 100 ,
159  const double weight = 1.0 ) const
160  {
161  return plot1D ( value, title, low, high, bins, weight );
162  }
163  // ==========================================================================
188  AIDA::IHistogram1D* plot1D
189  ( const double value ,
190  const Gaudi::Histo1DDef& hdef ,
191  const double weight = 1.0 ) const ;
192  // ==========================================================================
203  inline AIDA::IHistogram1D* plot
204  ( const double value ,
205  const Gaudi::Histo1DDef& hdef ,
206  const double weight = 1.0 ) const
207  {
208  return plot1D ( value, hdef, weight );
209  }
210  // ==========================================================================
275  // ==========================================================================
276  AIDA::IHistogram1D* plot1D
277  ( const double value ,
278  const HistoID& ID ,
279  const std::string& title ,
280  const double low ,
281  const double high ,
282  const unsigned long bins = 100 ,
283  const double weight = 1.0 ) const ;
284  // ==========================================================================
299  inline AIDA::IHistogram1D* plot
300  ( const double value ,
301  const HistoID& ID ,
302  const std::string& title ,
303  const double low ,
304  const double high ,
305  const unsigned long bins = 100 ,
306  const double weight = 1.0 ) const
307  {
308  return plot1D ( value, ID, title, low, high, bins, weight );
309  }
310  // ==========================================================================
336  AIDA::IHistogram1D* plot1D
337  ( const double value ,
338  const HistoID& ID ,
339  const Gaudi::Histo1DDef& hdef ,
340  const double weight = 1.0 ) const ;
341  // ==========================================================================
353  inline AIDA::IHistogram1D* plot
354  ( const double value ,
355  const HistoID& ID ,
356  const Gaudi::Histo1DDef& hdef ,
357  const double weight = 1.0 ) const
358  {
359  return plot1D ( value, ID, hdef, weight );
360  }
424  template <class FUNCTION,class OBJECT>
425  inline AIDA::IHistogram1D* plot
426  ( const FUNCTION& func ,
427  OBJECT first ,
428  OBJECT last ,
429  const std::string& title ,
430  const double low ,
431  const double high ,
432  const unsigned long bins = 100 ) const
433  {
434  AIDA::IHistogram1D* h(0);
435  if ( produceHistos() )
436  {
437  // retrieve or book the histogram
438  h = histo1D ( title ) ;
439  if ( 0 == h ) { h = book1D ( title , low , high , bins ); }
440  // fill histogram
441  while( first != last && 0 != h )
442  { h = fill ( h , func( *first ) , 1.0 , title ) ; ++first ; }
443  }
444  return h ;
445  }
446  // ==========================================================================
502  template <class FUNCTION,class OBJECT>
503  inline AIDA::IHistogram1D* plot
504  ( const FUNCTION& func ,
505  OBJECT first ,
506  OBJECT last ,
507  const HistoID& ID ,
508  const std::string& title ,
509  const double low ,
510  const double high ,
511  const unsigned long bins = 100 ) const
512  {
513  AIDA::IHistogram1D* h(0);
514  if ( produceHistos() )
515  {
516  // retrieve or book the histogram
517  h = histo1D ( ID ) ;
518  if ( 0 == h ) { h = book1D ( ID , title , low , high , bins ); }
519  // fill histogram
520  while( first != last && 0 != h )
521  { h = fill( h , func( *first ) , 1.0 , title ) ; ++first ; }
522  }
523  return h;
524  }
525  // ==========================================================================
594  template <class FUNCTION,class OBJECT,class WEIGHT>
595  inline AIDA::IHistogram1D* plot
596  ( const FUNCTION& func ,
597  OBJECT first ,
598  OBJECT last ,
599  const std::string& title ,
600  const double low ,
601  const double high ,
602  const unsigned long bins ,
603  const WEIGHT& weight ) const
604  {
605  AIDA::IHistogram1D* h(0);
606  if ( produceHistos() )
607  {
608  // retrieve or book the histogram
609  h = histo1D ( title ) ;
610  if ( 0 == h ) { h = book1D ( title , low , high , bins ); }
611  // fill histogram
612  while ( first != last && 0 != h )
613  { h = fill ( h ,
614  func ( *first ) ,
615  weight ( *first ) , title ) ; ++first ; }
616  }
617  return h;
618  }
619  // ==========================================================================
686  template <class FUNCTION,class OBJECT,class WEIGHT>
687  inline AIDA::IHistogram1D* plot
688  ( const FUNCTION& func ,
689  OBJECT first ,
690  OBJECT last ,
691  const HistoID& ID ,
692  const std::string& title ,
693  const double low ,
694  const double high ,
695  const unsigned long bins ,
696  const WEIGHT& weight ) const
697  {
698  AIDA::IHistogram1D* h(0);
699  if ( produceHistos() )
700  {
701  // retrieve or book the histogram
702  h = histo1D ( ID ) ;
703  if ( 0 == h ) { h = book1D ( ID , title , low , high , bins ); }
704  // fill histogram
705  while( first != last && 0 != h )
706  { h = fill ( h ,
707  func ( *first ) ,
708  weight ( *first ) , title ) ; ++first ; }
709  }
710  return h ;
711  }
712  // ==========================================================================
713  // ================================= 1D Histograms ==========================
714  // =============================== Variable Binning =========================
715  // ==========================================================================
755  AIDA::IHistogram1D* plot1D
756  ( const double value ,
757  const std::string& title ,
758  const HistoBinEdges& edges ,
759  const double weight = 1.0 ) const ;
760  // ==========================================================================
824  // ==========================================================================
825  AIDA::IHistogram1D* plot1D
826  ( const double value ,
827  const HistoID& ID ,
828  const std::string& title ,
829  const HistoBinEdges& edges ,
830  const double weight = 1.0 ) const ;
831  // ==========================================================================
832  // ================================= 2D Histograms ==========================
833  // ==========================================================================
884  AIDA::IHistogram2D* plot2D
885  ( const double valueX ,
886  const double valueY ,
887  const std::string& title ,
888  const double lowX ,
889  const double highX ,
890  const double lowY ,
891  const double highY ,
892  const unsigned long binsX = 50 ,
893  const unsigned long binsY = 50 ,
894  const double weight = 1.0 ) const;
895  // ==========================================================================
972  AIDA::IHistogram2D* plot2D
973  ( const double valueX ,
974  const double valueY ,
975  const HistoID& ID ,
976  const std::string& title ,
977  const double lowX ,
978  const double highX ,
979  const double lowY ,
980  const double highY ,
981  const unsigned long binsX = 50 ,
982  const unsigned long binsY = 50 ,
983  const double weight = 1.0 ) const;
984  // ==========================================================================
985  // ================================= 2D Histograms ==========================
986  // =============================== Variable Binning =========================
987  // ==========================================================================
1033  AIDA::IHistogram2D* plot2D
1034  ( const double valueX ,
1035  const double valueY ,
1036  const std::string& title ,
1037  const HistoBinEdges& edgesX ,
1038  const HistoBinEdges& edgesY ,
1039  const double weight = 1.0 ) const ;
1040  // ==========================================================================
1116  AIDA::IHistogram2D* plot2D
1117  ( const double valueX ,
1118  const double valueY ,
1119  const HistoID& ID ,
1120  const std::string& title ,
1121  const HistoBinEdges& edgesX ,
1122  const HistoBinEdges& edgesY ,
1123  const double weight = 1.0 ) const ;
1124  // ==========================================================================
1125  // ================================= 3D Histograms ==========================
1126  // ==========================================================================
1185  AIDA::IHistogram3D* plot3D
1186  ( const double valueX ,
1187  const double valueY ,
1188  const double valueZ ,
1189  const std::string& title ,
1190  const double lowX ,
1191  const double highX ,
1192  const double lowY ,
1193  const double highY ,
1194  const double lowZ ,
1195  const double highZ ,
1196  const unsigned long binsX = 10 ,
1197  const unsigned long binsY = 10 ,
1198  const unsigned long binsZ = 10 ,
1199  const double weight = 1.0 ) const;
1200  // ==========================================================================
1287  AIDA::IHistogram3D* plot3D
1288  ( const double valueX ,
1289  const double valueY ,
1290  const double valueZ ,
1291  const HistoID& ID ,
1292  const std::string& title ,
1293  const double lowX ,
1294  const double highX ,
1295  const double lowY ,
1296  const double highY ,
1297  const double lowZ ,
1298  const double highZ ,
1299  const unsigned long binsX = 10 ,
1300  const unsigned long binsY = 10 ,
1301  const unsigned long binsZ = 10 ,
1302  const double weight = 1.0 ) const;
1303  // ==========================================================================
1304  // ================================= 3D Histograms ==========================
1305  // =============================== Variable Binning =========================
1306  // ==========================================================================
1354  AIDA::IHistogram3D* plot3D
1355  ( const double valueX ,
1356  const double valueY ,
1357  const double valueZ ,
1358  const std::string& title ,
1359  const HistoBinEdges& edgesX ,
1360  const HistoBinEdges& edgesY ,
1361  const HistoBinEdges& edgesZ ,
1362  const double weight = 1.0 ) const ;
1363  // ==========================================================================
1364  // ==========================================================================
1449  AIDA::IHistogram3D* plot3D
1450  ( const double valueX ,
1451  const double valueY ,
1452  const double valueZ ,
1453  const HistoID& ID ,
1454  const std::string& title ,
1455  const HistoBinEdges& edgesX ,
1456  const HistoBinEdges& edgesY ,
1457  const HistoBinEdges& edgesZ ,
1458  const double weight = 1.0 ) const ;
1459  // ==========================================================================
1460  // ================================= 1D Profile =============================
1461  // ================================= Fixed binning ==========================
1462  // ==========================================================================
1511  AIDA::IProfile1D* profile1D
1512  ( const double valueX ,
1513  const double valueY ,
1514  const std::string& title ,
1515  const double lowX ,
1516  const double highX ,
1517  const unsigned long binsX = 100 ,
1518  const std::string& opt = "" ,
1519  const double lowY = -std::numeric_limits<double>::max() ,
1520  const double highY = std::numeric_limits<double>::max() ,
1521  const double weight = 1.0 ) const ;
1522  // ==========================================================================
1588  AIDA::IProfile1D* profile1D
1589  ( const double valueX ,
1590  const double valueY ,
1591  const HistoID& ID ,
1592  const std::string& title ,
1593  const double lowX ,
1594  const double highX ,
1595  const unsigned long binsX = 100 ,
1596  const std::string& opt = "" ,
1597  const double lowY = -std::numeric_limits<double>::max() ,
1598  const double highY = std::numeric_limits<double>::max() ,
1599  const double weight = 1.0 ) const;
1600  // ==========================================================================
1601  // ================================= 1D Profile =============================
1602  // ============================== Variable binning ==========================
1603  // ==========================================================================
1646  AIDA::IProfile1D* profile1D
1647  ( const double valueX ,
1648  const double valueY ,
1649  const std::string& title ,
1650  const HistoBinEdges& edges ,
1651  const double weight = 1.0 ) const ;
1652  // ==========================================================================
1714  AIDA::IProfile1D* profile1D
1715  ( const double valueX ,
1716  const double valueY ,
1717  const HistoID& ID ,
1718  const std::string& title ,
1719  const HistoBinEdges& edges ,
1720  const double weight = 1.0 ) const;
1721  // ==========================================================================
1722  // ================================= 2D Profile =============================
1723  // ==========================================================================
1774  AIDA::IProfile2D* profile2D
1775  ( const double valueX ,
1776  const double valueY ,
1777  const double valueZ ,
1778  const std::string& title ,
1779  const double lowX ,
1780  const double highX ,
1781  const double lowY ,
1782  const double highY ,
1783  const unsigned long binsX = 50 ,
1784  const unsigned long binsY = 50 ,
1785  const double weight = 1.0 ) const;
1786  // ==========================================================================
1854  AIDA::IProfile2D* profile2D
1855  ( const double valueX ,
1856  const double valueY ,
1857  const double valueZ ,
1858  const HistoID& ID ,
1859  const std::string& title ,
1860  const double lowX ,
1861  const double highX ,
1862  const double lowY ,
1863  const double highY ,
1864  const unsigned long binsX = 50 ,
1865  const unsigned long binsY = 50 ,
1866  const double weight = 1.0 ) const;
1867  // ==========================================================================
1868  // ================================= 2D Profile =============================
1869  // ============================== Variable binning ==========================
1870  // ==========================================================================
1916  AIDA::IProfile2D* profile2D
1917  ( const double valueX ,
1918  const double valueY ,
1919  const double valueZ ,
1920  const std::string& title ,
1921  const HistoBinEdges& edgesX ,
1922  const HistoBinEdges& edgesY ,
1923  const double weight = 1.0 ) const ;
1924  // ==========================================================================
1987  AIDA::IProfile2D* profile2D
1988  ( const double valueX ,
1989  const double valueY ,
1990  const double valueZ ,
1991  const HistoID& ID ,
1992  const std::string& title ,
1993  const HistoBinEdges& edgesX ,
1994  const HistoBinEdges& edgesY ,
1995  const double weight = 1.0 ) const;
1996  // ==========================================================================
1997 
1998 public: // 1D Fixed
1999 
2000  // ==========================================================================
2012  AIDA::IHistogram1D* book1D
2013  ( const std::string& title ,
2014  const double low = 0 ,
2015  const double high = 100 ,
2016  const unsigned long bins = 100 ) const ;
2017  // ==========================================================================
2030  inline AIDA::IHistogram1D* book
2031  ( const std::string& title ,
2032  const double low = 0 ,
2033  const double high = 100 ,
2034  const unsigned long bins = 100 ) const
2035  {
2036  return book1D( title, low, high, bins );
2037  }
2038  // ==========================================================================
2047  AIDA::IHistogram1D* book
2048  ( const Gaudi::Histo1DDef& hdef ) const ;
2049  // ==========================================================================
2060  AIDA::IHistogram1D* book1D
2061  ( const HistoID& ID ,
2062  const std::string& title ,
2063  const double low = 0 ,
2064  const double high = 100 ,
2065  const unsigned long bins = 100 ) const ;
2066  // ==========================================================================
2080  inline AIDA::IHistogram1D* book
2081  ( const HistoID& ID ,
2082  const std::string& title ,
2083  const double low = 0 ,
2084  const double high = 100 ,
2085  const unsigned long bins = 100 ) const
2086  {
2087  return book1D( ID, title, low, high, bins );
2088  }
2089  // ==========================================================================
2097  inline AIDA::IHistogram1D* book
2098  ( const HistoID& ID ,
2099  const Gaudi::Histo1DDef& hdef ) const ;
2100  // ==========================================================================
2101 
2102 public: // 1D Variable
2103 
2104  // ==========================================================================
2115  AIDA::IHistogram1D* book1D
2116  ( const std::string& title ,
2117  const HistoBinEdges& edges ) const ;
2118  // ==========================================================================
2128  AIDA::IHistogram1D* book1D
2129  ( const HistoID& ID ,
2130  const std::string& title ,
2131  const HistoBinEdges& edges ) const ;
2132  // ==========================================================================
2133 
2134 public: // 2D Fixed
2135 
2136  // ==========================================================================
2151  AIDA::IHistogram2D* book2D
2152  ( const std::string& title ,
2153  const double lowX = 0 ,
2154  const double highX = 100 ,
2155  const unsigned long binsX = 50 ,
2156  const double lowY = 0 ,
2157  const double highY = 100 ,
2158  const unsigned long binsY = 50 ) const ;
2159  // ==========================================================================
2170  AIDA::IHistogram2D* book2D
2171  ( const HistoID& ID ,
2172  const std::string& title ,
2173  const double lowX = 0 ,
2174  const double highX = 100 ,
2175  const unsigned long binsX = 50 ,
2176  const double lowY = 0 ,
2177  const double highY = 100 ,
2178  const unsigned long binsY = 50 ) const ;
2179  // ==========================================================================
2180 
2181 public: // 2D Variable
2182 
2183  // ==========================================================================
2195  AIDA::IHistogram2D * book2D
2196  ( const std::string& title ,
2197  const HistoBinEdges& edgesX ,
2198  const HistoBinEdges& edgesY ) const ;
2199  // ==========================================================================
2210  AIDA::IHistogram2D * book2D
2211  ( const HistoID& ID ,
2212  const std::string& title ,
2213  const HistoBinEdges& edgesX ,
2214  const HistoBinEdges& edgesY ) const ;
2215  // ==========================================================================
2216 
2217 public: // 3D Fixed
2218 
2219  // ==========================================================================
2237  AIDA::IHistogram3D* book3D
2238  ( const std::string& title ,
2239  const double lowX = 0 ,
2240  const double highX = 100 ,
2241  const unsigned long binsX = 10 ,
2242  const double lowY = 0 ,
2243  const double highY = 100 ,
2244  const unsigned long binsY = 10 ,
2245  const double lowZ = 0 ,
2246  const double highZ = 100 ,
2247  const unsigned long binsZ = 10 ) const ;
2248  // ==========================================================================
2265  AIDA::IHistogram3D* book3D
2266  ( const HistoID& ID ,
2267  const std::string& title ,
2268  const double lowX = 0 ,
2269  const double highX = 100 ,
2270  const unsigned long binsX = 10 ,
2271  const double lowY = 0 ,
2272  const double highY = 100 ,
2273  const unsigned long binsY = 10 ,
2274  const double lowZ = 0 ,
2275  const double highZ = 100 ,
2276  const unsigned long binsZ = 10 ) const ;
2277  // ==========================================================================
2278 
2279 public: // 3D Variable
2280 
2281  // ==========================================================================
2294  AIDA::IHistogram3D * book3D
2295  ( const std::string& title ,
2296  const HistoBinEdges& edgesX ,
2297  const HistoBinEdges& edgesY ,
2298  const HistoBinEdges& edgesZ ) const ;
2299  // ==========================================================================
2311  AIDA::IHistogram3D * book3D
2312  ( const HistoID& ID ,
2313  const std::string& title ,
2314  const HistoBinEdges& edgesX ,
2315  const HistoBinEdges& edgesY ,
2316  const HistoBinEdges& edgesZ ) const ;
2317  // ==========================================================================
2318 
2319 public: // 1D Fixed Profiles
2320 
2321  // ==========================================================================
2336  AIDA::IProfile1D* bookProfile1D
2337  ( const std::string& title ,
2338  const double low = 0 ,
2339  const double high = 100 ,
2340  const unsigned long bins = 100 ,
2341  const std::string& opt = "" ,
2342  const double lowY = -std::numeric_limits<double>::max() ,
2343  const double highY = std::numeric_limits<double>::max() ) const;
2344  // ==========================================================================
2360  AIDA::IProfile1D* bookProfile1D
2361  ( const HistoID& ID ,
2362  const std::string& title ,
2363  const double low = 0 ,
2364  const double high = 100 ,
2365  const unsigned long bins = 100 ,
2366  const std::string& opt = "" ,
2367  const double lowY = -std::numeric_limits<double>::max() ,
2368  const double highY = std::numeric_limits<double>::max() ) const;
2369  // ==========================================================================
2370 
2371 public: // 1D Variable Profiles
2372 
2373  // ==========================================================================
2383  AIDA::IProfile1D* bookProfile1D
2384  ( const std::string& title ,
2385  const HistoBinEdges& edges ) const;
2386  // ==========================================================================
2396  AIDA::IProfile1D* bookProfile1D
2397  ( const HistoID& ID ,
2398  const std::string& title ,
2399  const HistoBinEdges& edges ) const;
2400  // ==========================================================================
2401 
2402 public: // 2D Profiles
2403 
2404  // ==========================================================================
2419  AIDA::IProfile2D* bookProfile2D
2420  ( const std::string& title ,
2421  const double lowX = 0 ,
2422  const double highX = 100 ,
2423  const unsigned long binsX = 50 ,
2424  const double lowY = 0 ,
2425  const double highY = 100 ,
2426  const unsigned long binsY = 50 ) const ;
2427  // ==========================================================================
2441  AIDA::IProfile2D* bookProfile2D
2442  ( const HistoID& ID ,
2443  const std::string& title ,
2444  const double lowX = 0 ,
2445  const double highX = 100 ,
2446  const unsigned long binsX = 50 ,
2447  const double lowY = 0 ,
2448  const double highY = 100 ,
2449  const unsigned long binsY = 50 ) const ;
2450  // ==========================================================================
2451 
2452 public: // 2D Profiles
2453 
2454  // ==========================================================================
2465  AIDA::IProfile2D* bookProfile2D
2466  ( const std::string& title ,
2467  const HistoBinEdges& edgesX,
2468  const HistoBinEdges& edgesY ) const ;
2469  // ==========================================================================
2479  AIDA::IProfile2D* bookProfile2D
2480  ( const HistoID& ID ,
2481  const std::string& title ,
2482  const HistoBinEdges& edgesX,
2483  const HistoBinEdges& edgesY ) const ;
2484  // ==========================================================================
2485 
2486 public:
2487 
2488  // ==========================================================================
2496  AIDA::IHistogram1D* fill
2497  ( AIDA::IHistogram1D* histo ,
2498  const double value ,
2499  const double weight ,
2500  const std::string& title = "" ) const ;
2501  // ==========================================================================
2510  AIDA::IHistogram2D* fill
2511  ( AIDA::IHistogram2D* histo ,
2512  const double valueX ,
2513  const double valueY ,
2514  const double weight ,
2515  const std::string& title = "" ) const ;
2516  // ==========================================================================
2526  AIDA::IHistogram3D* fill
2527  ( AIDA::IHistogram3D* histo ,
2528  const double valueX ,
2529  const double valueY ,
2530  const double valueZ ,
2531  const double weight ,
2532  const std::string& title = "" ) const ;
2533  // ==========================================================================
2542  AIDA::IProfile1D* fill
2543  ( AIDA::IProfile1D* histo ,
2544  const double valueX ,
2545  const double valueY ,
2546  const double weight ,
2547  const std::string& title = "" ) const ;
2548  // ==========================================================================
2558  AIDA::IProfile2D* fill
2559  ( AIDA::IProfile2D* histo ,
2560  const double valueX ,
2561  const double valueY ,
2562  const double valueZ ,
2563  const double weight ,
2564  const std::string& title = "" ) const ;
2565  // ==========================================================================
2566 public:
2567  // ==========================================================================
2571  inline AIDA::IHistogram1D* histo1D ( const std::string& title ) const
2572  {
2573  Histo1DMapTitle::const_iterator found = histo1DMapTitle().find( title ) ;
2574  return ( histo1DMapTitle().end() == found ? 0 : found->second );
2575  }
2576  // ==========================================================================
2584  inline AIDA::IHistogram1D* histo ( const std::string& title ) const
2585  {
2586  return histo1D( title );
2587  }
2588  // ==========================================================================
2592  inline AIDA::IHistogram2D* histo2D ( const std::string& title ) const
2593  {
2594  Histo2DMapTitle::const_iterator found = histo2DMapTitle().find( title ) ;
2595  return ( histo2DMapTitle().end() == found ? 0 : found->second );
2596  }
2597  // ==========================================================================
2601  inline AIDA::IHistogram3D* histo3D ( const std::string& title ) const
2602  {
2603  Histo3DMapTitle::const_iterator found = histo3DMapTitle().find( title ) ;
2604  return ( histo3DMapTitle().end() == found ? 0 : found->second );
2605  }
2606  // ==========================================================================
2610  inline AIDA::IProfile1D* profile1D ( const std::string& title ) const
2611  {
2612  Profile1DMapTitle::const_iterator found = profile1DMapTitle().find( title ) ;
2613  return ( profile1DMapTitle().end() == found ? 0 : found->second );
2614  }
2615  // ==========================================================================
2619  inline AIDA::IProfile2D* profile2D ( const std::string& title ) const
2620  {
2621  Profile2DMapTitle::const_iterator found = profile2DMapTitle().find( title ) ;
2622  return ( profile2DMapTitle().end() == found ? 0 : found->second );
2623  }
2624  // ==========================================================================
2625 public:
2626  // ==========================================================================
2630  AIDA::IHistogram1D* histo1D ( const HistoID& ID ) const;
2631  // ==========================================================================
2639  inline AIDA::IHistogram1D* histo ( const HistoID& ID ) const
2640  {
2641  return histo1D( ID );
2642  }
2643  // ==========================================================================
2647  AIDA::IHistogram2D* histo2D ( const HistoID& ID ) const;
2648  // ==========================================================================
2652  AIDA::IHistogram3D* histo3D ( const HistoID& ID ) const;
2653  // ==========================================================================
2657  AIDA::IProfile1D* profile1D ( const HistoID& ID ) const;
2658  // ==========================================================================
2662  AIDA::IProfile2D* profile2D ( const HistoID& ID ) const;
2663  // ==========================================================================
2664 public:
2665  // ==========================================================================
2667  inline bool histoExists ( const std::string& title ) const
2668  {
2669  return
2670  ( 0 != histo ( title ) ||
2671  0 != histo2D ( title ) ||
2672  0 != histo3D ( title ) ||
2673  0 != profile1D ( title ) ||
2674  0 != profile2D ( title ) );
2675  }
2676  // ==========================================================================
2678  inline bool histoExists ( const HistoID& ID ) const
2679  {
2680  return
2681  ( 0 != histo ( ID ) ||
2682  0 != histo2D ( ID ) ||
2683  0 != histo3D ( ID ) ||
2684  0 != profile1D ( ID ) ||
2685  0 != profile2D ( ID ) );
2686  }
2688  unsigned int totalNumberOfHistos() const;
2689  // ==========================================================================
2690 public: // trivial & non-trivial accessors
2691  // ==========================================================================
2693  inline bool produceHistos () const { return m_produceHistos ; }
2695  inline bool fullDetail () const { return m_fullDetail ; }
2697  inline bool checkForNaN () const { return m_checkForNaN ; }
2699  inline bool splitHistoDir () const { return m_splitHistoDir ; }
2701  inline HistoID::NumericID histoOffSet () const { return m_histoOffSet ; }
2703  inline const std::string& histoTopDir () const { return m_histoTopDir ; }
2705  inline const std::string& histoDir () const { return m_histoDir ; }
2707  std::string histoPath () const;
2709  inline bool histosPrint () const { return m_histosPrint ; }
2711  inline bool histoCountersPrint () const { return m_histoCountersPrint ; }
2713  inline bool useNumericAutoIDs() const { return m_useNumericAutoIDs; }
2714  // ==========================================================================
2719  int printHistos ( const MSG::Level level = MSG::ALWAYS ) const ;
2720  // ==========================================================================
2748  const Histo1DMapTitle & histo1DMapTitle() const { return m_histo1DMapTitle; }
2749  // ==========================================================================
2774  const Histo1DMapID & histo1DMapID () const { return m_histo1DMapID ; }
2775  // ==========================================================================
2803  const Histo2DMapTitle & histo2DMapTitle() const { return m_histo2DMapTitle ; }
2804  // ==========================================================================
2829  const Histo2DMapID& histo2DMapID () const { return m_histo2DMapID ; }
2830  // ==========================================================================
2858  const Histo3DMapTitle & histo3DMapTitle () const { return m_histo3DMapTitle ; }
2859  // ==========================================================================
2884  const Histo3DMapID & histo3DMapID () const { return m_histo3DMapID; }
2885  // ==========================================================================
2913  const Profile1DMapTitle & profile1DMapTitle() const { return m_profile1DMapTitle; }
2914  // ==========================================================================
2939  const Profile1DMapID & profile1DMapID () const { return m_profile1DMapID; }
2940  // ==========================================================================
2968  const Profile2DMapTitle & profile2DMapTitle() const { return m_profile2DMapTitle; }
2969  // ==========================================================================
2994  const Profile2DMapID & profile2DMapID () const { return m_profile2DMapID; }
2995  // ==========================================================================
2996 public: // trivial setters
2997  // ==========================================================================
2999  inline void setProduceHistos ( const bool val ) { m_produceHistos = val ; }
3001  inline void setFullDetail ( const bool val ) { m_fullDetail = val ; }
3003  inline void setCheckForNaN ( const bool val ) { m_checkForNaN = val ; }
3005  inline void setSplitHistoDir ( const bool val ) { m_splitHistoDir = val ; }
3007  inline void setHistoOffSet ( const HistoID::NumericID val )
3008  { m_histoOffSet = val ; }
3009  // ==========================================================================
3011  inline void setHistoTopDir ( const std::string& val ) { m_histoTopDir = val ; }
3012  // ==========================================================================
3014  inline void setHistoDir ( const std::string& val ) { m_histoDir = val ; }
3015  // ==========================================================================
3016 public:
3017  // ==========================================================================
3019  GaudiHistos ( const std::string & name,
3020  ISvcLocator * pSvcLocator );
3021  // ==========================================================================
3023  GaudiHistos ( const std::string& type ,
3024  const std::string& name ,
3025  const IInterface* parent );
3026  // ==========================================================================
3028  virtual ~GaudiHistos() {}
3029  // ==========================================================================
3030 protected:
3031  // ==========================================================================
3035  virtual StatusCode initialize()
3036 #ifdef __ICC
3037  { return i_ghInitialize(); }
3038  StatusCode i_ghInitialize()
3039 #endif
3040  ;
3041  // ==========================================================================
3045  virtual StatusCode finalize()
3046 #ifdef __ICC
3047  { return i_ghFinalize(); }
3048  StatusCode i_ghFinalize()
3049 #endif
3050  ;
3051  // ==========================================================================
3052 private:
3053  // ==========================================================================
3055  bool noHistos() const;
3056  // ===========================================unsigned===============================
3058  void initGaudiHistosConstructor();
3059  // ==========================================================================
3065  void monitorHisto( const AIDA::IBaseHistogram* hist,
3066  const HistoID& ID ) const;
3067  // ==========================================================================
3072  void newHistoID( const std::string & title,
3073  HistoID& ID ) const;
3074  // ==========================================================================
3076  void stringSearchReplace( std::string & title,
3077  const std::string & A,
3078  const std::string & B ) const;
3079  // ==========================================================================
3080 protected:
3081  // ==========================================================================
3083  std::string convertTitleToID( const std::string & title ) const;
3084  // ==========================================================================
3085 private:
3086  // ==========================================================================
3088  void printHistoHandler ( Property& /* theProp */ ) ; // "HistoPrint"
3089  // ==========================================================================
3090 private:
3091  // ==========================================================================
3101  HistoID::NumericID m_histoOffSet ;
3103  std::string m_histoTopDir ;
3105  std::string m_histoDir ;
3112  // ==========================================================================
3117  // ==========================================================================
3122  // ==========================================================================
3127  // ==========================================================================
3132  // ==========================================================================
3137  // ==========================================================================
3139  std::string m_histo1DTableFormat ;
3143  std::string m_histo1DTableHeader ;
3149  std::map<std::string,std::string> m_idReplaceInfo;
3150  // ==========================================================================
3151 };
3152 // ============================================================================
3153 // The END
3154 // ============================================================================
3155 #endif // GAUDIALG_GAUDIHISTOS_H
3156 // ============================================================================
void setFullDetail(const bool val)
set flag to control output level of histograms
Definition: GaudiHistos.h:3001
HistoID::NumericID histoOffSet() const
get the value for histogram offset (property "HistoOffSet")
Definition: GaudiHistos.h:2701
bool fullDetail() const
get flag to control output level of histograms
Definition: GaudiHistos.h:2695
GaudiAlg::Histo3DMapID Histo3DMapID
the actual type for (ID)->(3D histogram) mapping
Definition: GaudiHistos.h:68
bool m_declareMoniHists
Flag to turn on/off the registration of histograms to the Monitoring Service.
Definition: GaudiHistos.h:3111
GaudiAlg::Histo1DMapTitle Histo1DMapTitle
the actual type for title->(1D histogram) mapping
Definition: GaudiHistos.h:60
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:2592
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
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:2619
GAUDI_API AIDA::IHistogram1D * book(IHistogramSvc *svc, const std::string &path, const Gaudi::Histo1DDef &hist)
helper function to book 1D-histogram
Definition: HistoDef.cpp:132
std::vector< double > HistoBinEdges
Type for bin edges for variable binning histograms.
Definition: HistoID.h:35
Profile1DMapID m_profile1DMapID
the actual storage/access of 1D profile histograms by unique ID
Definition: GaudiHistos.h:3131
GaudiAlg::Profile1DMapTitle Profile1DMapTitle
the actual type for title->(1D profile histogram) mapping
Definition: GaudiHistos.h:75
virtual ~GaudiHistos()
Destructor.
Definition: GaudiHistos.h:3028
GaudiAlg::ID HistoID
The actual type for histogram identifier.
Definition: HistoID.h:25
GaudiAlg::HistoID HistoID
the actual type for histogram identifier
Definition: GaudiHistos.h:55
AIDA::IHistogram1D * histo(const HistoID &ID) const
access the EXISTING 1D histogram by ID
Definition: GaudiHistos.h:2639
const Profile2DMapID & profile2DMapID() const
get access to the map of 2D profile histograms index via a ID
Definition: GaudiHistos.h:2994
Histo1DMapID m_histo1DMapID
the actual storage/access of 1D histograms by unique ID
Definition: GaudiHistos.h:3116
std::string m_histoTopDir
histogram top level directory
Definition: GaudiHistos.h:3103
Histo3DMapTitle m_histo3DMapTitle
the actual storage/access of 3D histograms by unique title
Definition: GaudiHistos.h:3124
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:37
void setHistoOffSet(const HistoID::NumericID val)
set a value for histogram offset (property "HistoOffSet"
Definition: GaudiHistos.h:3007
const Histo3DMapTitle & histo3DMapTitle() const
get access to the map of all 3D histograms indexed via their title
Definition: GaudiHistos.h:2858
GaudiAlg::Histo3DMapTitle Histo3DMapTitle
the actual type for title->(3D histogram) mapping
Definition: GaudiHistos.h:70
bool histoExists(const HistoID &ID) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2678
GaudiAlg::Profile2DMapID Profile2DMapID
the actual type for (ID)->(2D profile histogram) mapping
Definition: GaudiHistos.h:78
std::string m_histo1DTableFormat
format for printout of 1D-histograms as a table
Definition: GaudiHistos.h:3139
GaudiAlg::Profile1DMapID Profile1DMapID
the actual type for (ID)->(1D profile histogram) mapping
Definition: GaudiHistos.h:73
bool splitHistoDir() const
get the flag for histogram path split (property "HistoSplitDir")
Definition: GaudiHistos.h:2699
const Profile2DMapTitle & profile2DMapTitle() const
get access to the map of all 2D profile histograms indexed via their title
Definition: GaudiHistos.h:2968
GaudiAlg::HistoBinEdges HistoBinEdges
Edges for variable binning.
Definition: GaudiHistos.h:83
Histo2DMapTitle m_histo2DMapTitle
the actual storage/access of 2D histograms by unique title
Definition: GaudiHistos.h:3119
void setProduceHistos(const bool val)
set the flag for histogram production (property "HistoProduce")
Definition: GaudiHistos.h:2999
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:2610
const Histo1DMapTitle & histo1DMapTitle() const
get access to the map of all 1D histograms indexed via their title
Definition: GaudiHistos.h:2748
GaudiAlg::Profile2DMapTitle Profile2DMapTitle
the actual type for title->(2D profile histogram) mapping
Definition: GaudiHistos.h:80
void setCheckForNaN(const bool val)
set the flag for NaN checks (property "HistoCheckForNan")
Definition: GaudiHistos.h:3003
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:2571
Profile1DMapTitle m_profile1DMapTitle
the actual storage/access of 1D profile histograms by unique title
Definition: GaudiHistos.h:3129
string type
Definition: gaudirun.py:126
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
HistoID::NumericID m_histoOffSet
general histogram ID offset (only works for automatically assigned numeric IDs)
Definition: GaudiHistos.h:3101
Definition of the basic interface.
Definition: IInterface.h:160
Simple helper class for description of 1D-histogram The class is targeted to act as the primary "hist...
Definition: HistoDef.h:32
bool m_histoCountersPrint
print histogram counters at finalization
Definition: GaudiHistos.h:3109
const Histo1DMapID & histo1DMapID() const
get access to the map of all 1D histograms index via ID
Definition: GaudiHistos.h:2774
AIDA::IHistogram1D * histo(const std::string &title) const
access the EXISTING 1D histogram by title
Definition: GaudiHistos.h:2584
bool useNumericAutoIDs() const
Use old style sequencial numerical automatically assigned IDs ?
Definition: GaudiHistos.h:2713
GaudiAlg::Histo1DMapID Histo1DMapID
the actual type for (ID)->(1D histogram) mapping
Definition: GaudiHistos.h:58
const Profile1DMapTitle & profile1DMapTitle() const
get access to the map of all 1D profile histograms indexed via their title
Definition: GaudiHistos.h:2913
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:3141
bool m_splitHistoDir
split histogram directory name (very useful for Hbook)
Definition: GaudiHistos.h:3099
map_type::const_iterator const_iterator
Definition: Map.h:99
Profile2DMapID m_profile2DMapID
the actual storage/access of 2D profile histograms by unique ID
Definition: GaudiHistos.h:3136
tuple end
Definition: IOTest.py:101
GaudiAlg::Histo2DMapTitle Histo2DMapTitle
the actual type for title->(2D histogram) mapping
Definition: GaudiHistos.h:65
void setSplitHistoDir(const bool val)
set the flag for histogram path split (property "HistoSplitDir")
Definition: GaudiHistos.h:3005
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
Histo1DMapTitle m_histo1DMapTitle
the actual storage/access of 1D histograms by unique title
Definition: GaudiHistos.h:3114
Profile2DMapTitle m_profile2DMapTitle
the actual storage/access of 2D profile histograms by unique title
Definition: GaudiHistos.h:3134
const Profile1DMapID & profile1DMapID() const
get access to the map of 1D profile histograms index via a ID
Definition: GaudiHistos.h:2939
bool histoCountersPrint() const
print histogram counters at finalization ?
Definition: GaudiHistos.h:2711
void setHistoTopDir(const std::string &val)
set top-level histogram directory (property "HistoTopDir")
Definition: GaudiHistos.h:3011
bool produceHistos() const
get the flag for histogram production (property "HistoProduce")
Definition: GaudiHistos.h:2693
GaudiAlg::Histo2DMapID Histo2DMapID
the actual type for (ID)->(2D histogram) mapping
Definition: GaudiHistos.h:63
Histo3DMapID m_histo3DMapID
the actual storage/access of 3D histograms by unique ID
Definition: GaudiHistos.h:3126
const std::string & histoDir() const
get histogram directory (property "HistoDir")
Definition: GaudiHistos.h:2705
Common class providing an architecture-independent hash map.
Definition: HashMap.h:108
const std::string & histoTopDir() const
get top-level histogram directory (property "HistoTopDir")
Definition: GaudiHistos.h:2703
const Histo2DMapID & histo2DMapID() const
get access to the map of 2D histograms index via ID
Definition: GaudiHistos.h:2829
Histo2DMapID m_histo2DMapID
the actual storage/access of 2D histograms by unique ID
Definition: GaudiHistos.h:3121
void setHistoDir(const std::string &val)
set histogram directory (property "HistoDir")
Definition: GaudiHistos.h:3014
Templated base class providing common histogramming methods for GaudiAlgorithm and GaudiTool like cla...
Definition: GaudiHistos.h:50
std::string m_histoDir
histogram directory
Definition: GaudiHistos.h:3105
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:3149
bool m_produceHistos
flag to SWITCH ON/SWITCH OFF the histogrm fillling and booking
Definition: GaudiHistos.h:3093
bool histoExists(const std::string &title) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2667
const Histo2DMapTitle & histo2DMapTitle() const
get access to the map of all 2D histograms indexed via their title
Definition: GaudiHistos.h:2803
#define GAUDI_API
Definition: Kernel.h:108
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
std::string m_histo1DTableHeader
the header for the table of 1-D historgrams
Definition: GaudiHistos.h:3143
bool m_useNumericAutoIDs
Flag to switch back to the old style sequencial numerical automatic IDs.
Definition: GaudiHistos.h:3145
ID class for Histogram and Ntuples.
Definition: GaudiHistoID.h:46
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:2601
bool m_checkForNaN
flag to control check for Nan/Finite while filling the histogram
Definition: GaudiHistos.h:3097
bool histosPrint() const
print histograms at finalization ?
Definition: GaudiHistos.h:2709
bool m_fullDetail
flag to control output level of histograms
Definition: GaudiHistos.h:3095
const Histo3DMapID & histo3DMapID() const
get access to the map of all 3D histograms index via a ID
Definition: GaudiHistos.h:2884
bool checkForNaN() const
get the flag for NaN checks (property "HistoCheckForNan")
Definition: GaudiHistos.h:2697
bool m_histosPrint
print histograms at finalization
Definition: GaudiHistos.h:3107