The Gaudi Framework  v30r3 (a5ef0a68)
HistoDef.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_HISTODEF_H
2 #define GAUDIKERNEL_HISTODEF_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <iosfwd>
9 #include <string>
10 // ============================================================================
11 // Gaudi
12 // ============================================================================
13 #include "GaudiKernel/Kernel.h"
14 // ============================================================================
15 // Forward decalrations
16 // ============================================================================
17 class IHistogramSvc;
18 namespace AIDA
19 {
20  class IHistogram1D;
21 }
22 // ============================================================================
23 namespace Gaudi
24 {
25  // ==========================================================================
33  class GAUDI_API Histo1DDef final
34  {
35  public:
36  // ========================================================================
43  Histo1DDef( double low, double high, int bins = 100, std::string title = "" );
44  // ========================================================================
51  Histo1DDef( std::string title = "", double low = 0.0, double high = 1.0, int bins = 100 );
52  // ========================================================================
53  public:
54  // ========================================================================
56  double lowEdge() const { return m_low; }
58  double highEdge() const { return m_high; }
60  int bins() const { return m_bins; }
62  const std::string& title() const { return m_title; }
63  // ========================================================================
64  public:
65  // ========================================================================
67  void setLowEdge( double value ) { m_low = value; }
69  void setHighEdge( double value ) { m_high = value; }
71  void setBins( int value ) { m_bins = value; }
73  void setTitle( std::string value ) { m_title = std::move( value ); }
74  // ========================================================================
75  public:
76  // ========================================================================
78  std::ostream& fillStream( std::ostream& o ) const;
79  // ========================================================================
80  public:
81  // ========================================================================
83  friend bool operator<( const Histo1DDef& left, const Histo1DDef& right );
85  friend bool operator==( const Histo1DDef& left, const Histo1DDef& right );
87  friend bool operator!=( const Histo1DDef& left, const Histo1DDef& right );
88  // ========================================================================
90  friend std::ostream& operator<<( std::ostream& o, const Gaudi::Histo1DDef& histo );
91  // ========================================================================
92  public:
93  // ========================================================================
95  bool ok() const { return 0 < bins() && lowEdge() < highEdge(); }
96  // ========================================================================
97  private:
98  // ========================================================================
99  // Histogram title
101  // Low Edge
102  double m_low;
103  // High Edge
104  double m_high;
105  // Number of bins
106  int m_bins;
107  // ========================================================================
108  };
109  // ==========================================================================
115  namespace Histos
116  {
117  // ========================================================================
123  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& path, const Gaudi::Histo1DDef& hist );
124  // ========================================================================
131  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& dir, const std::string& id,
132  const Gaudi::Histo1DDef& hist );
133  // ========================================================================
140  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& dir, const int id,
141  const Gaudi::Histo1DDef& hist );
142  // ========================================================================
143  } // end of namespace Gaudi::Histos
144  // ==========================================================================
145 } // end of namespace Gaudi
146 // ============================================================================
147 // The END
148 // ============================================================================
149 #endif // GAUDIKERNEL_HISTODEF_H
150 // ============================================================================
helper namespace to collect useful definitions, types, constants and functions, related to manipulati...
void setBins(int value)
set number of bis
Definition: HistoDef.h:71
bool operator!=(const GaudiUtils::Allocator< T1 > &, const GaudiUtils::Allocator< T2 > &)
Definition: Allocator.h:256
double highEdge() const
get the high edge
Definition: HistoDef.h:58
double lowEdge() const
get the low edge
Definition: HistoDef.h:56
void setHighEdge(double value)
set high edge
Definition: HistoDef.h:69
GAUDI_API AIDA::IHistogram1D * book(IHistogramSvc *svc, const std::string &dir, const int id, const Gaudi::Histo1DDef &hist)
helper function to book 1D-histogram
Definition: HistoDef.cpp:120
GaudiKernel.
Definition: Fill.h:10
const std::string & title() const
get the title
Definition: HistoDef.h:62
STL class.
double m_high
High Edge.
Definition: HistoDef.h:104
bool operator==(const GaudiUtils::Allocator< T1 > &, const GaudiUtils::Allocator< T2 > &)
Definition: Allocator.h:246
Simple helper class for description of 1D-histogram The class is targeted to act as the primary "hist...
Definition: HistoDef.h:33
std::string m_title
Histogram title.
Definition: HistoDef.h:100
bool ok() const
check if all fields are "reasonable"
Definition: HistoDef.h:95
Definition of the IHistogramSvc interface class.
Definition: IHistogramSvc.h:47
T move(T...args)
void setTitle(std::string value)
set the title
Definition: HistoDef.h:73
bool operator<(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:206
int bins() const
get the number of bins
Definition: HistoDef.h:60
#define GAUDI_API
Definition: Kernel.h:104
int m_bins
Number of bins.
Definition: HistoDef.h:106
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1
double m_low
Low Edge.
Definition: HistoDef.h:102
void setLowEdge(double value)
set low edge
Definition: HistoDef.h:67
std::ostream & operator<<(std::ostream &str, const GaudiAlg::ID &id)
Operator overloading for ostream.
Definition: GaudiHistoID.h:136