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