All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
HistoTool.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_HISTOTOOL_H
2 #define GAUDIALG_HISTOTOOL_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // Gaudi
7 // ============================================================================
9 #include "GaudiAlg/IHistoTool.h"
10 // ============================================================================
11 
28 class HistoTool : virtual public GaudiHistoTool ,
29  virtual public IHistoTool
30 {
31 public:
33 
42  HistoTool ( const std::string& type,
43  const std::string& name,
44  const IInterface* parent);
45 
46  // protected virtual destructor
47  ~HistoTool( ) override = default;
48 
49 public:
50 
51  // ================================= 1D Histograms ========================================
52 
53  // fill the histogram (book on demand)
54  AIDA::IHistogram1D* plot1D
55  ( const double value ,
56  const std::string& title ,
57  const double low ,
58  const double high ,
59  const unsigned long bins = 100 ,
60  const double weight = 1.0 ) const override
61 
62  {
64  ( value , title , low , high , bins , weight ) ;
65  };
66 
67  // fill the histogram with forced ID assignement (book on demand)
68  AIDA::IHistogram1D* plot1D
69  ( const double value ,
70  const HistoID& ID ,
71  const std::string& title ,
72  const double low ,
73  const double high ,
74  const unsigned long bins = 100 ,
75  const double weight = 1.0 ) const override
76  {
78  ( value , ID , title , low , high , bins , weight ) ;
79  };
80 
81  // ================================= 2D Histograms ========================================
82 
83  // fill the histogram (book on demand)
84  AIDA::IHistogram2D* plot2D
85  ( const double valueX ,
86  const double valueY ,
87  const std::string& title ,
88  const double lowX ,
89  const double highX ,
90  const double lowY ,
91  const double highY ,
92  const unsigned long binsX = 50 ,
93  const unsigned long binsY = 50 ,
94  const double weight = 1.0 ) const override
95  {
97  ( valueX, valueY, title, lowX, highX, lowY, highY, binsX, binsY, weight ) ;
98  };
99 
100  // fill the histogram (book on demand)
101  AIDA::IHistogram2D* plot2D
102  ( const double valueX ,
103  const double valueY ,
104  const HistoID& ID ,
105  const std::string& title ,
106  const double lowX ,
107  const double highX ,
108  const double lowY ,
109  const double highY ,
110  const unsigned long binsX = 50 ,
111  const unsigned long binsY = 50 ,
112  const double weight = 1.0 ) const override
113  {
115  ( valueX, valueY, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight ) ;
116  };
117 
118  // ================================= 3D Histograms ========================================
119 
120  // fill the histogram (book on demand)
121  AIDA::IHistogram3D* plot3D
122  ( const double valueX ,
123  const double valueY ,
124  const double valueZ ,
125  const std::string& title ,
126  const double lowX ,
127  const double highX ,
128  const double lowY ,
129  const double highY ,
130  const double lowZ ,
131  const double highZ ,
132  const unsigned long binsX = 10 ,
133  const unsigned long binsY = 10 ,
134  const unsigned long binsZ = 10 ,
135  const double weight = 1.0 ) const override
136  {
138  ( valueX, valueY, valueZ, title,
139  lowX, highX, lowY, highY, lowZ, highZ, binsX, binsY, binsZ, weight ) ;
140  };
141 
142  // fill the histogram (book on demand)
143  AIDA::IHistogram3D* plot3D
144  ( const double valueX ,
145  const double valueY ,
146  const double valueZ ,
147  const HistoID& ID ,
148  const std::string& title ,
149  const double lowX ,
150  const double highX ,
151  const double lowY ,
152  const double highY ,
153  const double lowZ ,
154  const double highZ ,
155  const unsigned long binsX = 10 ,
156  const unsigned long binsY = 10 ,
157  const unsigned long binsZ = 10 ,
158  const double weight = 1.0 ) const override
159  {
161  ( valueX, valueY, valueZ, ID, title,
162  lowX, highX, lowY, highY, lowZ, highZ, binsX, binsY, binsZ, weight ) ;
163  };
164 
165 public:
166 
167  // book the 1D histogram
168  AIDA::IHistogram1D* book1D
169  ( const std::string& title ,
170  const double low = 0 ,
171  const double high = 100 ,
172  const unsigned long bins = 100 ) const override
173  {
174  return GaudiHistoTool::book1D ( title , low , high , bins ) ;
175  };
176 
177  // book the 2D histogram
178  AIDA::IHistogram2D* book2D
179  ( const std::string& title ,
180  const double lowX = 0 ,
181  const double highX = 100 ,
182  const unsigned long binsX = 50 ,
183  const double lowY = 0 ,
184  const double highY = 100 ,
185  const unsigned long binsY = 50 ) const override
186  {
187  return GaudiHistoTool::book2D ( title, lowX, highX, binsX, lowY, highY, binsY ) ;
188  }
189 
190  // book the 3D histogram
191  AIDA::IHistogram3D* book3D
192  ( const std::string& title ,
193  const double lowX = 0 ,
194  const double highX = 100 ,
195  const unsigned long binsX = 10 ,
196  const double lowY = 0 ,
197  const double highY = 100 ,
198  const unsigned long binsY = 10 ,
199  const double lowZ = 0 ,
200  const double highZ = 100 ,
201  const unsigned long binsZ = 10 ) const override
202  {
203  return GaudiHistoTool::book3D ( title,
204  lowX, highX, binsX,
205  lowY, highY, binsY,
206  lowZ, highZ, binsZ ) ;
207  }
208 
209  // book the 1D histogram with forced ID
210  AIDA::IHistogram1D* book1D
211  ( const HistoID& ID ,
212  const std::string& title = "" ,
213  const double low = 0 ,
214  const double high = 100 ,
215  const unsigned long bins = 100 ) const override
216  {
217  return GaudiHistoTool::book1D ( ID , title , low , high , bins ) ;
218  };
219 
220  // book the 2D histogram with forced ID
221  AIDA::IHistogram2D* book2D
222  ( const HistoID& ID ,
223  const std::string& title ,
224  const double lowX = 0 ,
225  const double highX = 100 ,
226  const unsigned long binsX = 50 ,
227  const double lowY = 0 ,
228  const double highY = 100 ,
229  const unsigned long binsY = 50 ) const override
230  {
231  return GaudiHistoTool::book2D ( ID, title, lowX, highX, binsX, lowY, highY, binsY ) ;
232  }
233 
234  // book the 3D histogram with forced ID
235  AIDA::IHistogram3D* book3D
236  ( const HistoID& ID ,
237  const std::string& title ,
238  const double lowX = 0 ,
239  const double highX = 100 ,
240  const unsigned long binsX = 10 ,
241  const double lowY = 0 ,
242  const double highY = 100 ,
243  const unsigned long binsY = 10 ,
244  const double lowZ = 0 ,
245  const double highZ = 100 ,
246  const unsigned long binsZ = 10 ) const override
247  {
248  return GaudiHistoTool::book3D ( ID, title,
249  lowX, highX, binsX,
250  lowY, highY, binsY,
251  lowZ, highZ, binsZ ) ;
252  }
253 
254  // fill the histo with the value and weight
255  AIDA::IHistogram1D* fill
256  ( AIDA::IHistogram1D* histo ,
257  const double value ,
258  const double weight ,
259  const std::string& title = "") const override
260  {
261  return GaudiHistoTool::fill ( histo , value , weight , title ) ;
262  };
263 
264  // fill the 2D histo with the value and weight
265  AIDA::IHistogram2D* fill
266  ( AIDA::IHistogram2D* histo ,
267  const double valueX ,
268  const double valueY ,
269  const double weight ,
270  const std::string& title = "" ) const override
271  {
272  return GaudiHistoTool::fill ( histo , valueX , valueY , weight , title ) ;
273  };
274 
275  // fill the 3D histo with the value and weight
276  AIDA::IHistogram3D* fill
277  ( AIDA::IHistogram3D* histo ,
278  const double valueX ,
279  const double valueY ,
280  const double valueZ ,
281  const double weight ,
282  const std::string& title = "" ) const override
283  {
284  return GaudiHistoTool::fill ( histo , valueX , valueY , valueZ, weight , title ) ;
285  };
286 
287  // access the EXISTING 1D histogram by title
288  AIDA::IHistogram1D* histo1D ( const std::string& title ) const override
289  { return GaudiHistoTool::histo1D ( title ) ; }
290 
291  // access the EXISTING 1D histogram by ID
292  AIDA::IHistogram1D* histo1D ( const HistoID& ID ) const override
293  { return GaudiHistoTool::histo1D ( ID ) ; }
294 
295  // access the EXISTING 2D histogram by title
296  AIDA::IHistogram2D* histo2D ( const std::string& title ) const override
297  { return GaudiHistoTool::histo2D ( title ) ; }
298 
299  // access the EXISTING 2D histogram by ID
300  AIDA::IHistogram2D* histo2D ( const HistoID& ID ) const override
301  { return GaudiHistoTool::histo2D ( ID ) ; }
302 
303  // access the EXISTING 3D histogram by title
304  AIDA::IHistogram3D* histo3D ( const std::string& title ) const override
305  { return GaudiHistoTool::histo3D ( title ) ; }
306 
307  // access the EXISTING 3D histogram by ID
308  AIDA::IHistogram3D* histo3D ( const HistoID& ID ) const override
309  { return GaudiHistoTool::histo3D ( ID ) ; }
310 
311  // check the existence AND validity of the histogram with given title
312  bool histoExists ( const std::string& title ) const override
313  { return GaudiHistoTool::histoExists ( title ) ; }
314 
315  // check the existence AND validity of the histogram with given title
316  bool histoExists ( const HistoID& ID ) const override
317  { return GaudiHistoTool::histoExists ( ID ) ; }
318 
319 
320  HistoTool() = delete;
321  HistoTool ( const HistoTool& ) = delete;
322  HistoTool& operator=( const HistoTool& ) = delete;
323 
324 };
325 
326 #endif // GAUDIALG_HISTOTOOL_H
bool histoExists(const std::string &title) const override
check the existence AND validity of the histogram with given title
Definition: HistoTool.h:312
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:2306
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:85
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:192
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
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
Simple tool for histogramming (component)
Definition: HistoTool.h:28
Header file for class : GaudiHistoTool.
AIDA::IHistogram1D * histo(const std::string &title) const
access the EXISTING 1D histogram by title
Definition: IHistoTool.h:651
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:288
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:122
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:256
Simple class to extend the functionality of class GaudiTool.
STL class.
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:308
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:179
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:169
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:2288
Definition of the basic interface.
Definition: IInterface.h:234
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
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:304
HistoTool & operator=(const HistoTool &)=delete
~HistoTool() override=default
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:300
HistoTool()=delete
bool histoExists(const HistoID &ID) const override
check the existence AND validity of the histogram with given title
Definition: HistoTool.h:316
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:292
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)
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)
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:55
bool histoExists(const std::string &title) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2378
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
IHistoTool::HistoID HistoID
Definition: HistoTool.h:32
virtual const IInterface * parent() const =0
The parent of the concrete AlgTool.
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)
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:296
ID class for Histogram and Ntuples.
Definition: GaudiHistoID.h:44
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:2315
virtual const std::string & name() const =0
Retrieve the name of the instance.
An abstract interface for "histogramming tool".
Definition: IHistoTool.h:31
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