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