The Gaudi Framework  v36r9p1 (5c15b2bb)
HistoDef.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIKERNEL_HISTODEF_H
12 #define GAUDIKERNEL_HISTODEF_H 1
13 // ============================================================================
14 // Include files
15 // ============================================================================
16 // STD & STL
17 // ============================================================================
18 #include <iosfwd>
19 #include <string>
20 // ============================================================================
21 // Gaudi
22 // ============================================================================
23 #include "GaudiKernel/Kernel.h"
24 // ============================================================================
25 // Forward decalrations
26 // ============================================================================
27 class IHistogramSvc;
28 namespace AIDA {
29  class IHistogram1D;
30 } // namespace AIDA
31 // ============================================================================
32 namespace Gaudi {
33  // ==========================================================================
41  class GAUDI_API Histo1DDef final {
42  public:
43  // ========================================================================
50  Histo1DDef( double low, double high, int bins = 100, std::string title = "" );
51  // ========================================================================
58  Histo1DDef( std::string title = "", double low = 0.0, double high = 1.0, int bins = 100 );
59  // ========================================================================
60  public:
61  // ========================================================================
63  double lowEdge() const { return m_low; }
65  double highEdge() const { return m_high; }
67  int bins() const { return m_bins; }
69  const std::string& title() const { return m_title; }
70  // ========================================================================
71  public:
72  // ========================================================================
74  void setLowEdge( double value ) { m_low = value; }
76  void setHighEdge( double value ) { m_high = value; }
78  void setBins( int value ) { m_bins = value; }
80  void setTitle( std::string value ) { m_title = std::move( value ); }
81  // ========================================================================
82  public:
83  // ========================================================================
85  std::ostream& fillStream( std::ostream& o ) const;
86  // ========================================================================
87  public:
88  // ========================================================================
90  friend bool operator<( const Histo1DDef& left, const Histo1DDef& right );
92  friend bool operator==( const Histo1DDef& left, const Histo1DDef& right );
94  friend bool operator!=( const Histo1DDef& left, const Histo1DDef& right );
95  // ========================================================================
98  // ========================================================================
99  public:
100  // ========================================================================
102  bool ok() const { return 0 < bins() && lowEdge() < highEdge(); }
103  // ========================================================================
104  private:
105  // ========================================================================
106  // Histogram title
108  // Low Edge
109  double m_low;
110  // High Edge
111  double m_high;
112  // Number of bins
113  int m_bins;
114  // ========================================================================
115  };
116  // ==========================================================================
122  namespace Histos {
123  // ========================================================================
129  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& path, const Gaudi::Histo1DDef& hist );
130  // ========================================================================
137  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& dir, const std::string& id,
138  const Gaudi::Histo1DDef& hist );
139  // ========================================================================
146  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& dir, const int id,
147  const Gaudi::Histo1DDef& hist );
148  // ========================================================================
149  } // namespace Histos
150  // ==========================================================================
151 } // end of namespace Gaudi
152 // ============================================================================
153 // The END
154 // ============================================================================
155 #endif // GAUDIKERNEL_HISTODEF_H
AIDA
GaudiKernel.
Definition: Fill.h:20
std::string
STL class.
IHistogramSvc
Definition: IHistogramSvc.h:56
std::move
T move(T... args)
HistoEx.histo
histo
Definition: HistoEx.py:105
Gaudi::Histo1DDef::setLowEdge
void setLowEdge(double value)
set low edge
Definition: HistoDef.h:74
Gaudi::operator==
bool operator==(const T &v, const Property< TP, V, H > &p)
delegate (value == property) to property operator==
Definition: Property.h:435
Gaudi::Histo1DDef::m_high
double m_high
High Edge.
Definition: HistoDef.h:111
Gaudi::Histo1DDef::m_low
double m_low
Low Edge.
Definition: HistoDef.h:109
Gaudi::Histo1DDef::setTitle
void setTitle(std::string value)
set the title
Definition: HistoDef.h:80
Gaudi::Histo1DDef
Definition: HistoDef.h:41
Gaudi::Histo1DDef::setHighEdge
void setHighEdge(double value)
set high edge
Definition: HistoDef.h:76
std::ostream
STL class.
Gaudi::Histos::book
GAUDI_API AIDA::IHistogram1D * book(IHistogramSvc *svc, const std::string &path, const Gaudi::Histo1DDef &hist)
helper function to book 1D-histogram
Definition: HistoDef.cpp:97
Gaudi::Histo1DDef::ok
bool ok() const
check if all fields are "reasonable"
Definition: HistoDef.h:102
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:961
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
Gaudi::Histo1DDef::highEdge
double highEdge() const
get the high edge
Definition: HistoDef.h:65
Kernel.h
Gaudi::Histo1DDef::m_bins
int m_bins
Number of bins.
Definition: HistoDef.h:113
Gaudi::Histo1DDef::m_title
std::string m_title
Histogram title.
Definition: HistoDef.h:107
Gaudi::operator<
bool operator<(const Gaudi::Histo1DDef &left, const Gaudi::Histo1DDef &right)
Definition: HistoDef.cpp:59
Gaudi::Histo1DDef::lowEdge
double lowEdge() const
get the low edge
Definition: HistoDef.h:63
Gaudi::Histo1DDef::bins
int bins() const
get the number of bins
Definition: HistoDef.h:67
Gaudi::Histo1DDef::title
const std::string & title() const
get the title
Definition: HistoDef.h:69
Gaudi::Histo1DDef::setBins
void setBins(int value)
set number of bis
Definition: HistoDef.h:78
Gaudi::operator!=
bool operator!=(const T &v, const Property< TP, V, H > &p)
delegate (value != property) to property operator!=
Definition: Property.h:442
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::operator<<
std::ostream & operator<<(std::ostream &o, const RootAddress &addr)
Definition: MIHelpers.h:20
Histos