Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
HistoTool.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 GAUDIALG_HISTOTOOL_H
12 #define GAUDIALG_HISTOTOOL_H 1
13 // ============================================================================
14 // Include files
15 // ============================================================================
16 // Gaudi
17 // ============================================================================
19 #include "GaudiAlg/IHistoTool.h"
20 // ============================================================================
21 
38 class HistoTool : virtual public GaudiHistoTool, virtual public IHistoTool {
39 public:
41 
50  HistoTool( const std::string& type, const std::string& name, const IInterface* parent );
51 
52 public:
53  // ================================= 1D Histograms ========================================
54 
55  // fill the histogram (book on demand)
56  AIDA::IHistogram1D* plot1D( const double value, const std::string& title, const double low, const double high,
57  const unsigned long bins = 100, const double weight = 1.0 ) const override
58 
59  {
60  return GaudiHistoTool::plot1D( value, title, low, high, bins, weight );
61  };
62 
63  // fill the histogram with forced ID assignement (book on demand)
64  AIDA::IHistogram1D* plot1D( const double value, const HistoID& ID, const std::string& title, const double low,
65  const double high, const unsigned long bins = 100,
66  const double weight = 1.0 ) const override {
67  return GaudiHistoTool::plot1D( value, ID, title, low, high, bins, weight );
68  };
69 
70  // ================================= 2D Histograms ========================================
71 
72  // fill the histogram (book on demand)
73  AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const std::string& title, const double lowX,
74  const double highX, const double lowY, const double highY, const unsigned long binsX = 50,
75  const unsigned long binsY = 50, const double weight = 1.0 ) const override {
76  return GaudiHistoTool::plot2D( valueX, valueY, title, lowX, highX, lowY, highY, binsX, binsY, weight );
77  };
78 
79  // fill the histogram (book on demand)
80  AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
81  const double lowX, const double highX, const double lowY, const double highY,
82  const unsigned long binsX = 50, const unsigned long binsY = 50,
83  const double weight = 1.0 ) const override {
84  return GaudiHistoTool::plot2D( valueX, valueY, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight );
85  };
86 
87  // ================================= 3D Histograms ========================================
88 
89  // fill the histogram (book on demand)
90  AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const std::string& title,
91  const double lowX, const double highX, const double lowY, const double highY,
92  const double lowZ, const double highZ, const unsigned long binsX = 10,
93  const unsigned long binsY = 10, const unsigned long binsZ = 10,
94  const double weight = 1.0 ) const override {
95  return GaudiHistoTool::plot3D( valueX, valueY, valueZ, title, lowX, highX, lowY, highY, lowZ, highZ, binsX, binsY,
96  binsZ, weight );
97  };
98 
99  // fill the histogram (book on demand)
100  AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
101  const std::string& title, const double lowX, const double highX, const double lowY,
102  const double highY, const double lowZ, const double highZ, const unsigned long binsX = 10,
103  const unsigned long binsY = 10, const unsigned long binsZ = 10,
104  const double weight = 1.0 ) const override {
105  return GaudiHistoTool::plot3D( valueX, valueY, valueZ, ID, title, lowX, highX, lowY, highY, lowZ, highZ, binsX,
106  binsY, binsZ, weight );
107  };
108 
109 public:
110  // book the 1D histogram
111  AIDA::IHistogram1D* book1D( const std::string& title, const double low = 0, const double high = 100,
112  const unsigned long bins = 100 ) const override {
113  return GaudiHistoTool::book1D( title, low, high, bins );
114  };
115 
116  // book the 2D histogram
117  AIDA::IHistogram2D* book2D( const std::string& title, const double lowX = 0, const double highX = 100,
118  const unsigned long binsX = 50, const double lowY = 0, const double highY = 100,
119  const unsigned long binsY = 50 ) const override {
120  return GaudiHistoTool::book2D( title, lowX, highX, binsX, lowY, highY, binsY );
121  }
122 
123  // book the 3D histogram
124  AIDA::IHistogram3D* book3D( const std::string& title, const double lowX = 0, const double highX = 100,
125  const unsigned long binsX = 10, const double lowY = 0, const double highY = 100,
126  const unsigned long binsY = 10, const double lowZ = 0, const double highZ = 100,
127  const unsigned long binsZ = 10 ) const override {
128  return GaudiHistoTool::book3D( title, lowX, highX, binsX, lowY, highY, binsY, lowZ, highZ, binsZ );
129  }
130 
131  // book the 1D histogram with forced ID
132  AIDA::IHistogram1D* book1D( const HistoID& ID, const std::string& title = "", const double low = 0,
133  const double high = 100, const unsigned long bins = 100 ) const override {
134  return GaudiHistoTool::book1D( ID, title, low, high, bins );
135  };
136 
137  // book the 2D histogram with forced ID
138  AIDA::IHistogram2D* book2D( const HistoID& ID, const std::string& title, const double lowX = 0,
139  const double highX = 100, const unsigned long binsX = 50, const double lowY = 0,
140  const double highY = 100, const unsigned long binsY = 50 ) const override {
141  return GaudiHistoTool::book2D( ID, title, lowX, highX, binsX, lowY, highY, binsY );
142  }
143 
144  // book the 3D histogram with forced ID
145  AIDA::IHistogram3D* book3D( const HistoID& ID, const std::string& title, const double lowX = 0,
146  const double highX = 100, const unsigned long binsX = 10, const double lowY = 0,
147  const double highY = 100, const unsigned long binsY = 10, const double lowZ = 0,
148  const double highZ = 100, const unsigned long binsZ = 10 ) const override {
149  return GaudiHistoTool::book3D( ID, title, lowX, highX, binsX, lowY, highY, binsY, lowZ, highZ, binsZ );
150  }
151 
152  // fill the histo with the value and weight
153  AIDA::IHistogram1D* fill( AIDA::IHistogram1D* histo, const double value, const double weight,
154  const std::string& title = "" ) const override {
155  return GaudiHistoTool::fill( histo, value, weight, title );
156  };
157 
158  // fill the 2D histo with the value and weight
159  AIDA::IHistogram2D* fill( AIDA::IHistogram2D* histo, const double valueX, const double valueY, const double weight,
160  const std::string& title = "" ) const override {
161  return GaudiHistoTool::fill( histo, valueX, valueY, weight, title );
162  };
163 
164  // fill the 3D histo with the value and weight
165  AIDA::IHistogram3D* fill( AIDA::IHistogram3D* histo, const double valueX, const double valueY, const double valueZ,
166  const double weight, const std::string& title = "" ) const override {
167  return GaudiHistoTool::fill( histo, valueX, valueY, valueZ, weight, title );
168  };
169 
170  // access the EXISTING 1D histogram by title
171  AIDA::IHistogram1D* histo1D( const std::string& title ) const override { return GaudiHistoTool::histo1D( title ); }
172 
173  // access the EXISTING 1D histogram by ID
174  AIDA::IHistogram1D* histo1D( const HistoID& ID ) const override { return GaudiHistoTool::histo1D( ID ); }
175 
176  // access the EXISTING 2D histogram by title
177  AIDA::IHistogram2D* histo2D( const std::string& title ) const override { return GaudiHistoTool::histo2D( title ); }
178 
179  // access the EXISTING 2D histogram by ID
180  AIDA::IHistogram2D* histo2D( const HistoID& ID ) const override { return GaudiHistoTool::histo2D( ID ); }
181 
182  // access the EXISTING 3D histogram by title
183  AIDA::IHistogram3D* histo3D( const std::string& title ) const override { return GaudiHistoTool::histo3D( title ); }
184 
185  // access the EXISTING 3D histogram by ID
186  AIDA::IHistogram3D* histo3D( const HistoID& ID ) const override { return GaudiHistoTool::histo3D( ID ); }
187 
188  // check the existence AND validity of the histogram with given title
189  bool histoExists( const std::string& title ) const override { return GaudiHistoTool::histoExists( title ); }
190 
191  // check the existence AND validity of the histogram with given title
192  bool histoExists( const HistoID& ID ) const override { return GaudiHistoTool::histoExists( ID ); }
193 
194  HistoTool() = delete;
195  HistoTool( const HistoTool& ) = delete;
196  HistoTool& operator=( const HistoTool& ) = delete;
197 };
198 
199 #endif // GAUDIALG_HISTOTOOL_H
HistoTool::book3D
AIDA::IHistogram3D * book3D(const HistoID &ID, const std::string &title, const double lowX=0, const double highX=100, const unsigned long binsX=10, const double lowY=0, const double highY=100, const unsigned long binsY=10, const double lowZ=0, const double highZ=100, const unsigned long binsZ=10) const override
book the 3D histogram with forced ID
Definition: HistoTool.h:145
HistoTool::fill
AIDA::IHistogram3D * fill(AIDA::IHistogram3D *histo, const double valueX, const double valueY, const double valueZ, const double weight, const std::string &title="") const override
fill the 3D histo with the value and weight
Definition: HistoTool.h:165
GaudiHistos< GaudiTool >::plot3D
AIDA::IHistogram3D * plot3D(const double valueX, const double valueY, const double valueZ, const std::string &title, const double lowX, const double highX, const double lowY, const double highY, const double lowZ, const double highZ, const unsigned long binsX=10, const unsigned long binsY=10, const unsigned long binsZ=10, const double weight=1.0) const
fill the 3D histogram (book on demand)
Definition: GaudiHistos_3DFixedBinning.icpp:121
GaudiHistoTool
Definition: GaudiHistoTool.h:49
HistoTool::histo3D
AIDA::IHistogram3D * histo3D(const HistoID &ID) const override
access the EXISTING 3D histogram by ID return the pointer to existing 3D histogram or NULL
Definition: HistoTool.h:186
GaudiHistos< GaudiTool >::plot1D
AIDA::IHistogram1D * plot1D(const double value, const std::string &title, const double low, const double high, const unsigned long bins=100, const double weight=1.0) const
fill the 1D histogram (book on demand)
Definition: GaudiHistos_1DFixedBinning.icpp:113
std::string
STL class.
GaudiAlg::ID
Definition: GaudiHistoID.h:53
GaudiHistos< GaudiTool >::histo2D
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:2297
HistoTool::plot2D
AIDA::IHistogram2D * plot2D(const double valueX, const double valueY, const std::string &title, const double lowX, const double highX, const double lowY, const double highY, const unsigned long binsX=50, const unsigned long binsY=50, const double weight=1.0) const override
fill the 2D histogram (book on demand)
Definition: HistoTool.h:73
HistoTool::book1D
AIDA::IHistogram1D * book1D(const std::string &title, const double low=0, const double high=100, const unsigned long bins=100) const override
book the 1D histogram
Definition: HistoTool.h:111
GaudiHistos< GaudiTool >::histo3D
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:2305
HistoTool::plot2D
AIDA::IHistogram2D * plot2D(const double valueX, const double valueY, const HistoID &ID, const std::string &title, const double lowX, const double highX, const double lowY, const double highY, const unsigned long binsX=50, const unsigned long binsY=50, const double weight=1.0) const override
fill the 2D histogram with forced ID assignment (book on demand)
Definition: HistoTool.h:80
GaudiHistos< GaudiTool >::histoExists
bool histoExists(const std::string &title) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2365
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
HistoTool::histo2D
AIDA::IHistogram2D * histo2D(const HistoID &ID) const override
access the EXISTING 2D histogram by ID return the pointer to existing 2D histogram or NULL
Definition: HistoTool.h:180
GaudiHistoTool.h
HistoTool::book2D
AIDA::IHistogram2D * book2D(const std::string &title, const double lowX=0, const double highX=100, const unsigned long binsX=50, const double lowY=0, const double highY=100, const unsigned long binsY=50) const override
book the 2D histogram
Definition: HistoTool.h:117
HistoTool::histo1D
AIDA::IHistogram1D * histo1D(const std::string &title) const override
access the EXISTING 1D histogram by title return the pointer to existing 1D histogram or NULL
Definition: HistoTool.h:171
IHistoTool
Definition: IHistoTool.h:40
HistoTool::fill
AIDA::IHistogram2D * fill(AIDA::IHistogram2D *histo, const double valueX, const double valueY, const double weight, const std::string &title="") const override
fill the 2D histo with the value and weight
Definition: HistoTool.h:159
GaudiHistos< GaudiTool >::plot2D
AIDA::IHistogram2D * plot2D(const double valueX, const double valueY, const std::string &title, const double lowX, const double highX, const double lowY, const double highY, const unsigned long binsX=50, const unsigned long binsY=50, const double weight=1.0) const
fill the 2D histogram (book on demand)
Definition: GaudiHistos_2DFixedBinning.icpp:116
HistoTool::histo3D
AIDA::IHistogram3D * histo3D(const std::string &title) const override
access the EXISTING 3D histogram by title return the pointer to existing 3D histogram or NULL
Definition: HistoTool.h:183
HistoTool::histoExists
bool histoExists(const HistoID &ID) const override
check the existence AND validity of the histogram with given title
Definition: HistoTool.h:192
HistoTool::fill
AIDA::IHistogram1D * fill(AIDA::IHistogram1D *histo, const double value, const double weight, const std::string &title="") const override
fill the 1D histo with the value and weight
Definition: HistoTool.h:153
HistoTool::plot3D
AIDA::IHistogram3D * plot3D(const double valueX, const double valueY, const double valueZ, const HistoID &ID, const std::string &title, const double lowX, const double highX, const double lowY, const double highY, const double lowZ, const double highZ, const unsigned long binsX=10, const unsigned long binsY=10, const unsigned long binsZ=10, const double weight=1.0) const override
fill the 3D histogram with forced ID assignment (book on demand)
Definition: HistoTool.h:100
HistoTool::book2D
AIDA::IHistogram2D * book2D(const HistoID &ID, const std::string &title, const double lowX=0, const double highX=100, const unsigned long binsX=50, const double lowY=0, const double highY=100, const unsigned long binsY=50) const override
book the 2D histogram with forced ID
Definition: HistoTool.h:138
HistoTool::HistoTool
HistoTool(const HistoTool &)=delete
HistoTool::histo2D
AIDA::IHistogram2D * histo2D(const std::string &title) const override
access the EXISTING 2D histogram by title return the pointer to existing 2D histogram or NULL
Definition: HistoTool.h:177
HistoTool
Definition: HistoTool.h:38
HistoTool::book1D
AIDA::IHistogram1D * book1D(const HistoID &ID, const std::string &title="", const double low=0, const double high=100, const unsigned long bins=100) const override
book the 1D histogram with forced ID
Definition: HistoTool.h:132
HistoTool::plot1D
AIDA::IHistogram1D * plot1D(const double value, const std::string &title, const double low, const double high, const unsigned long bins=100, const double weight=1.0) const override
fill the 1D histogram (book on demand)
Definition: HistoTool.h:56
IHistoTool.h
HistoTool::operator=
HistoTool & operator=(const HistoTool &)=delete
IAlgTool::type
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
GaudiHistos< GaudiTool >::book2D
AIDA::IHistogram2D * book2D(const std::string &title, const double lowX=0, const double highX=100, const unsigned long binsX=50, const double lowY=0, const double highY=100, const unsigned long binsY=50) const
book the 2D histogram
Definition: GaudiHistos_2DFixedBinning.icpp:17
HistoTool::HistoTool
HistoTool()=delete
HistoTool::book3D
AIDA::IHistogram3D * book3D(const std::string &title, const double lowX=0, const double highX=100, const unsigned long binsX=10, const double lowY=0, const double highY=100, const unsigned long binsY=10, const double lowZ=0, const double highZ=100, const unsigned long binsZ=10) const override
book the 3D histogram
Definition: HistoTool.h:124
IAlgTool::parent
virtual const IInterface * parent() const =0
The parent of the concrete AlgTool.
IHistoTool::histo
AIDA::IHistogram1D * histo(const std::string &title) const
access the EXISTING 1D histogram by title
Definition: IHistoTool.h:544
IInterface
Definition: IInterface.h:237
GaudiHistos< GaudiTool >::histo1D
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:2280
GaudiHistos< GaudiTool >::book3D
AIDA::IHistogram3D * book3D(const std::string &title, const double lowX=0, const double highX=100, const unsigned long binsX=10, const double lowY=0, const double highY=100, const unsigned long binsY=10, const double lowZ=0, const double highZ=100, const unsigned long binsZ=10) const
book the 3D histogram
Definition: GaudiHistos_3DFixedBinning.icpp:17
HistoTool::HistoID
IHistoTool::HistoID HistoID
Definition: HistoTool.h:40
HistoTool::histoExists
bool histoExists(const std::string &title) const override
check the existence AND validity of the histogram with given title
Definition: HistoTool.h:189
GaudiHistos< GaudiTool >::book1D
AIDA::IHistogram1D * book1D(const std::string &title, const double low=0, const double high=100, const unsigned long bins=100) const
book the 1D histogram
Definition: GaudiHistos_1DFixedBinning.icpp:17
HistoTool::histo1D
AIDA::IHistogram1D * histo1D(const HistoID &ID) const override
access the EXISTING 1D histogram by ID return the pointer to existing 1D histogram or NULL
Definition: HistoTool.h:174
HistoTool::plot1D
AIDA::IHistogram1D * plot1D(const double value, const HistoID &ID, const std::string &title, const double low, const double high, const unsigned long bins=100, const double weight=1.0) const override
fill the 1D histogram with forced ID assignement (book on demand)
Definition: HistoTool.h:64
GaudiHistos< GaudiTool >::fill
AIDA::IHistogram1D * fill(AIDA::IHistogram1D *histo, const double value, const double weight, const std::string &title="") const
fill the 1D histogram with the value and weight
Definition: GaudiHistos_1DFixedBinning.icpp:89
HistoTool::plot3D
AIDA::IHistogram3D * plot3D(const double valueX, const double valueY, const double valueZ, const std::string &title, const double lowX, const double highX, const double lowY, const double highY, const double lowZ, const double highZ, const unsigned long binsX=10, const unsigned long binsY=10, const unsigned long binsZ=10, const double weight=1.0) const override
fill the 3D histogram (book on demand)
Definition: HistoTool.h:90