|
||||
File indexing completed on 2025-01-18 09:57:38
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #ifndef GAUDIKERNEL_HISTODEF_H 0012 #define GAUDIKERNEL_HISTODEF_H 1 0013 // ============================================================================ 0014 // Include files 0015 // ============================================================================ 0016 // STD & STL 0017 // ============================================================================ 0018 #include <iosfwd> 0019 #include <string> 0020 // ============================================================================ 0021 // Gaudi 0022 // ============================================================================ 0023 #include "GaudiKernel/Kernel.h" 0024 // ============================================================================ 0025 // Forward decalrations 0026 // ============================================================================ 0027 class IHistogramSvc; ///< GaudiKernel 0028 namespace AIDA { 0029 class IHistogram1D; 0030 } // namespace AIDA 0031 // ============================================================================ 0032 namespace Gaudi { 0033 // ========================================================================== 0034 /** @class Histo1DDef HistoDef.h GaudiKernel/HistoDef.h 0035 * Simple helper class for description of 1D-histogram 0036 * The class is targeted to act as the primary "histogram property", 0037 * but clearly have significantly wider application range 0038 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 0039 * @date 2007-09-17 0040 */ 0041 class GAUDI_API Histo1DDef final { 0042 public: 0043 // ======================================================================== 0044 /** full constructor from edges, #bins and the title 0045 * @param low the low edge of the histogram 0046 * @param high the high edge of the histogram 0047 * @param bins number of bins 0048 * @param title the historgam title 0049 */ 0050 Histo1DDef( double low, double high, int bins = 100, std::string title = "" ); 0051 // ======================================================================== 0052 /** full constructor from edges, #bins and the title 0053 * @param title the historgam title 0054 * @param low the low edge of the histogram 0055 * @param high the high edge of the histogram 0056 * @param bins number of bins 0057 */ 0058 Histo1DDef( std::string title = "", double low = 0.0, double high = 1.0, int bins = 100 ); 0059 // ======================================================================== 0060 public: 0061 // ======================================================================== 0062 /// get the low edge 0063 double lowEdge() const { return m_low; } 0064 /// get the high edge 0065 double highEdge() const { return m_high; } 0066 /// get the number of bins 0067 int bins() const { return m_bins; } 0068 /// get the title 0069 const std::string& title() const { return m_title; } 0070 // ======================================================================== 0071 public: 0072 // ======================================================================== 0073 /// set low edge 0074 void setLowEdge( double value ) { m_low = value; } 0075 /// set high edge 0076 void setHighEdge( double value ) { m_high = value; } 0077 /// set number of bis 0078 void setBins( int value ) { m_bins = value; } 0079 /// set the title 0080 void setTitle( std::string value ) { m_title = std::move( value ); } 0081 // ======================================================================== 0082 public: 0083 // ======================================================================== 0084 /// printout of the histogram definition 0085 std::ostream& fillStream( std::ostream& o ) const; 0086 // ======================================================================== 0087 public: 0088 // ======================================================================== 0089 /// ordering operator (to please BoundedVerifier) 0090 friend bool operator<( const Histo1DDef& left, const Histo1DDef& right ); 0091 // ======================================================================== 0092 /// the streamer operator for class Gaudi::Histo1DDef 0093 friend std::ostream& operator<<( std::ostream& o, const Gaudi::Histo1DDef& histo ); 0094 // ======================================================================== 0095 public: 0096 // ======================================================================== 0097 /// check if all fields are "reasonable" 0098 bool ok() const { return 0 < bins() && lowEdge() < highEdge(); } 0099 // ======================================================================== 0100 private: 0101 // ======================================================================== 0102 // Histogram title 0103 std::string m_title; ///< Histogram title 0104 // Low Edge 0105 double m_low; ///< Low Edge 0106 // High Edge 0107 double m_high; ///< High Edge 0108 // Number of bins 0109 int m_bins; ///< Number of bins 0110 // ======================================================================== 0111 }; 0112 // ========================================================================== 0113 /** @namespace Gaudi::Histos 0114 * collection of simple utilities to deal with histograms 0115 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 0116 * @date 2007-09-17 0117 */ 0118 namespace Histos { 0119 // ======================================================================== 0120 /** helper function to book 1D-histogram 0121 * @param svc pointer to Histogram Service 0122 * @param path full path in Histogram Data Store 0123 * @param hist histogram desctription 0124 */ 0125 GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& path, const Gaudi::Histo1DDef& hist ); 0126 // ======================================================================== 0127 /** helper function to book 1D-histogram 0128 * @param svc pointer to Histogram Service 0129 * @param dir directory path in Histogram Data Store 0130 * @param id historgam identifier 0131 * @param hist histogram desctription 0132 */ 0133 GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& dir, const std::string& id, 0134 const Gaudi::Histo1DDef& hist ); 0135 // ======================================================================== 0136 /** helper function to book 1D-histogram 0137 * @param svc pointer to Histogram Service 0138 * @param dir directory path in Histogram Data Store 0139 * @param id historgam identifier 0140 * @param hist histogram desctription 0141 */ 0142 GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& dir, const int id, 0143 const Gaudi::Histo1DDef& hist ); 0144 // ======================================================================== 0145 } // namespace Histos 0146 // ========================================================================== 0147 } // end of namespace Gaudi 0148 // ============================================================================ 0149 // The END 0150 // ============================================================================ 0151 #endif // GAUDIKERNEL_HISTODEF_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |