The Gaudi Framework  v30r3 (a5ef0a68)
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, virtual public IHistoTool
29 {
30 public:
32 
41  HistoTool( const std::string& type, const std::string& name, const IInterface* parent );
42 
43 public:
44  // ================================= 1D Histograms ========================================
45 
46  // fill the histogram (book on demand)
47  AIDA::IHistogram1D* plot1D( const double value, const std::string& title, const double low, const double high,
48  const unsigned long bins = 100, const double weight = 1.0 ) const override
49 
50  {
51  return GaudiHistoTool::plot1D( value, title, low, high, bins, weight );
52  };
53 
54  // fill the histogram with forced ID assignement (book on demand)
55  AIDA::IHistogram1D* plot1D( const double value, const HistoID& ID, const std::string& title, const double low,
56  const double high, const unsigned long bins = 100,
57  const double weight = 1.0 ) const override
58  {
59  return GaudiHistoTool::plot1D( value, ID, title, low, high, bins, weight );
60  };
61 
62  // ================================= 2D Histograms ========================================
63 
64  // fill the histogram (book on demand)
65  AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const std::string& title, const double lowX,
66  const double highX, const double lowY, const double highY, const unsigned long binsX = 50,
67  const unsigned long binsY = 50, const double weight = 1.0 ) const override
68  {
69  return GaudiHistoTool::plot2D( valueX, valueY, title, lowX, highX, lowY, highY, binsX, binsY, weight );
70  };
71 
72  // fill the histogram (book on demand)
73  AIDA::IHistogram2D* plot2D( const double valueX, const double valueY, const HistoID& ID, const std::string& title,
74  const double lowX, const double highX, const double lowY, const double highY,
75  const unsigned long binsX = 50, const unsigned long binsY = 50,
76  const double weight = 1.0 ) const override
77  {
78  return GaudiHistoTool::plot2D( valueX, valueY, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight );
79  };
80 
81  // ================================= 3D Histograms ========================================
82 
83  // fill the histogram (book on demand)
84  AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const std::string& title,
85  const double lowX, const double highX, const double lowY, const double highY,
86  const double lowZ, const double highZ, const unsigned long binsX = 10,
87  const unsigned long binsY = 10, const unsigned long binsZ = 10,
88  const double weight = 1.0 ) const override
89  {
90  return GaudiHistoTool::plot3D( valueX, valueY, valueZ, title, lowX, highX, lowY, highY, lowZ, highZ, binsX, binsY,
91  binsZ, weight );
92  };
93 
94  // fill the histogram (book on demand)
95  AIDA::IHistogram3D* plot3D( const double valueX, const double valueY, const double valueZ, const HistoID& ID,
96  const std::string& title, const double lowX, const double highX, const double lowY,
97  const double highY, const double lowZ, const double highZ, const unsigned long binsX = 10,
98  const unsigned long binsY = 10, const unsigned long binsZ = 10,
99  const double weight = 1.0 ) const override
100  {
101  return GaudiHistoTool::plot3D( valueX, valueY, valueZ, ID, title, lowX, highX, lowY, highY, lowZ, highZ, binsX,
102  binsY, binsZ, weight );
103  };
104 
105 public:
106  // book the 1D histogram
107  AIDA::IHistogram1D* book1D( const std::string& title, const double low = 0, const double high = 100,
108  const unsigned long bins = 100 ) const override
109  {
110  return GaudiHistoTool::book1D( title, low, high, bins );
111  };
112 
113  // book the 2D histogram
114  AIDA::IHistogram2D* book2D( const std::string& title, const double lowX = 0, const double highX = 100,
115  const unsigned long binsX = 50, const double lowY = 0, const double highY = 100,
116  const unsigned long binsY = 50 ) const override
117  {
118  return GaudiHistoTool::book2D( title, lowX, highX, binsX, lowY, highY, binsY );
119  }
120 
121  // book the 3D histogram
122  AIDA::IHistogram3D* book3D( const std::string& title, const double lowX = 0, const double highX = 100,
123  const unsigned long binsX = 10, const double lowY = 0, const double highY = 100,
124  const unsigned long binsY = 10, const double lowZ = 0, const double highZ = 100,
125  const unsigned long binsZ = 10 ) const override
126  {
127  return GaudiHistoTool::book3D( title, lowX, highX, binsX, lowY, highY, binsY, lowZ, highZ, binsZ );
128  }
129 
130  // book the 1D histogram with forced ID
131  AIDA::IHistogram1D* book1D( const HistoID& ID, const std::string& title = "", const double low = 0,
132  const double high = 100, const unsigned long bins = 100 ) const override
133  {
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  {
142  return GaudiHistoTool::book2D( ID, title, lowX, highX, binsX, lowY, highY, binsY );
143  }
144 
145  // book the 3D histogram with forced ID
146  AIDA::IHistogram3D* book3D( const HistoID& ID, const std::string& title, const double lowX = 0,
147  const double highX = 100, const unsigned long binsX = 10, const double lowY = 0,
148  const double highY = 100, const unsigned long binsY = 10, const double lowZ = 0,
149  const double highZ = 100, const unsigned long binsZ = 10 ) const override
150  {
151  return GaudiHistoTool::book3D( ID, title, lowX, highX, binsX, lowY, highY, binsY, lowZ, highZ, binsZ );
152  }
153 
154  // fill the histo with the value and weight
155  AIDA::IHistogram1D* fill( AIDA::IHistogram1D* histo, const double value, const double weight,
156  const std::string& title = "" ) const override
157  {
158  return GaudiHistoTool::fill( histo, value, weight, title );
159  };
160 
161  // fill the 2D histo with the value and weight
162  AIDA::IHistogram2D* fill( AIDA::IHistogram2D* histo, const double valueX, const double valueY, const double weight,
163  const std::string& title = "" ) const override
164  {
165  return GaudiHistoTool::fill( histo, valueX, valueY, weight, title );
166  };
167 
168  // fill the 3D histo with the value and weight
169  AIDA::IHistogram3D* fill( AIDA::IHistogram3D* histo, const double valueX, const double valueY, const double valueZ,
170  const double weight, const std::string& title = "" ) const override
171  {
172  return GaudiHistoTool::fill( histo, valueX, valueY, valueZ, weight, title );
173  };
174 
175  // access the EXISTING 1D histogram by title
176  AIDA::IHistogram1D* histo1D( const std::string& title ) const override { return GaudiHistoTool::histo1D( title ); }
177 
178  // access the EXISTING 1D histogram by ID
179  AIDA::IHistogram1D* histo1D( const HistoID& ID ) const override { return GaudiHistoTool::histo1D( ID ); }
180 
181  // access the EXISTING 2D histogram by title
182  AIDA::IHistogram2D* histo2D( const std::string& title ) const override { return GaudiHistoTool::histo2D( title ); }
183 
184  // access the EXISTING 2D histogram by ID
185  AIDA::IHistogram2D* histo2D( const HistoID& ID ) const override { return GaudiHistoTool::histo2D( ID ); }
186 
187  // access the EXISTING 3D histogram by title
188  AIDA::IHistogram3D* histo3D( const std::string& title ) const override { return GaudiHistoTool::histo3D( title ); }
189 
190  // access the EXISTING 3D histogram by ID
191  AIDA::IHistogram3D* histo3D( const HistoID& ID ) const override { return GaudiHistoTool::histo3D( ID ); }
192 
193  // check the existence AND validity of the histogram with given title
194  bool histoExists( const std::string& title ) const override { return GaudiHistoTool::histoExists( title ); }
195 
196  // check the existence AND validity of the histogram with given title
197  bool histoExists( const HistoID& ID ) const override { return GaudiHistoTool::histoExists( ID ); }
198 
199  HistoTool() = delete;
200  HistoTool( const HistoTool& ) = delete;
201  HistoTool& operator=( const HistoTool& ) = delete;
202 };
203 
204 #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:194
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:131
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:65
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:122
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:540
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:176
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:84
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:155
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:191
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:114
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:107
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
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
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:162
Definition of the basic interface.
Definition: IInterface.h:277
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 * 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:95
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:188
HistoTool & operator=(const HistoTool &)=delete
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:73
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:185
HistoTool()=delete
bool histoExists(const HistoID &ID) const override
check the existence AND validity of the histogram with given title
Definition: HistoTool.h:197
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:179
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:47
bool histoExists(const std::string &title) const
check the existence AND validity of the histogram with given title
Definition: GaudiHistos.h:2378
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:55
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
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:146
IHistoTool::HistoID HistoID
Definition: HistoTool.h:31
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::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:169
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:182
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