The Gaudi Framework  master (d98a2936)
HistoDef.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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 #pragma once
12 
13 #include <GaudiKernel/Kernel.h>
14 #include <iosfwd>
15 #include <string>
16 
17 class IHistogramSvc;
18 namespace AIDA {
19  class IHistogram1D;
20 } // namespace AIDA
21 
22 namespace Gaudi {
30  class GAUDI_API Histo1DDef final {
31  public:
38  Histo1DDef( double low, double high, int bins = 100, std::string title = "" );
45  Histo1DDef( std::string title = "", double low = 0.0, double high = 1.0, int bins = 100 );
47  double lowEdge() const { return m_low; }
49  double highEdge() const { return m_high; }
51  int bins() const { return m_bins; }
53  const std::string& title() const { return m_title; }
55  void setLowEdge( double value ) { m_low = value; }
57  void setHighEdge( double value ) { m_high = value; }
59  void setBins( int value ) { m_bins = value; }
61  void setTitle( std::string value ) { m_title = std::move( value ); }
63  std::ostream& fillStream( std::ostream& o ) const;
65  friend bool operator<( const Histo1DDef& left, const Histo1DDef& right );
67  friend std::ostream& operator<<( std::ostream& o, const Gaudi::Histo1DDef& histo );
69  bool ok() const { return 0 < bins() && lowEdge() < highEdge(); }
70  std::string m_title;
71  double m_low;
72  double m_high;
73  int m_bins;
74  };
75 
81  namespace Histos {
87  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& path, const Gaudi::Histo1DDef& hist );
94  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& dir, const std::string& id,
95  const Gaudi::Histo1DDef& hist );
102  GAUDI_API AIDA::IHistogram1D* book( IHistogramSvc* svc, const std::string& dir, const int id,
103  const Gaudi::Histo1DDef& hist );
104  } // namespace Histos
105 } // namespace Gaudi
AIDA
Definition: Annotation.h:21
IHistogramSvc
Definition: IHistogramSvc.h:53
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
Gaudi::Histo1DDef::setLowEdge
void setLowEdge(double value)
set low edge
Definition: HistoDef.h:55
Gaudi::Histo1DDef::m_high
double m_high
High Edge.
Definition: HistoDef.h:72
Gaudi::Histo1DDef::m_low
double m_low
Low Edge.
Definition: HistoDef.h:71
Gaudi::Histo1DDef::setTitle
void setTitle(std::string value)
set the title
Definition: HistoDef.h:61
Gaudi::Histo1DDef
Definition: HistoDef.h:30
Gaudi::Histo1DDef::setHighEdge
void setHighEdge(double value)
set high edge
Definition: HistoDef.h:57
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:57
Gaudi::Histo1DDef::ok
bool ok() const
check if all fields are "reasonable"
Definition: HistoDef.h:69
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::Histo1DDef::highEdge
double highEdge() const
get the high edge
Definition: HistoDef.h:49
Kernel.h
Gaudi::Histo1DDef::m_bins
int m_bins
Number of bins.
Definition: HistoDef.h:73
Gaudi::Histo1DDef::m_title
std::string m_title
Histogram title.
Definition: HistoDef.h:70
Gaudi::operator<
bool operator<(const Gaudi::Histo1DDef &left, const Gaudi::Histo1DDef &right)
Definition: HistoDef.cpp:44
Gaudi::Histo1DDef::lowEdge
double lowEdge() const
get the low edge
Definition: HistoDef.h:47
Gaudi::operator<<
std::ostream & operator<<(std::ostream &o, const Gaudi::StringKey &key)
printout of the object reply on the native printout for the string
Definition: StringKey.h:176
Gaudi::Histo1DDef::bins
int bins() const
get the number of bins
Definition: HistoDef.h:51
Gaudi::Histo1DDef::title
const std::string & title() const
get the title
Definition: HistoDef.h:53
Gaudi::Histo1DDef::setBins
void setBins(int value)
set number of bis
Definition: HistoDef.h:59
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49