The Gaudi Framework  v29r0 (ff2e7097)
Fill.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // ============================================================================
4 // STD& STL
5 // ============================================================================
6 #include <string>
7 // ============================================================================
8 // GaudiAlg
9 // ============================================================================
10 #include "GaudiAlg/Fill.h"
11 // ============================================================================
12 // AIDA
13 // ============================================================================
14 #include "AIDA/IHistogram1D.h"
15 #include "AIDA/IHistogram2D.h"
16 #include "AIDA/IHistogram3D.h"
17 #include "AIDA/IProfile1D.h"
18 #include "AIDA/IProfile2D.h"
19 // ============================================================================
25 // ============================================================================
26 /* simple function to fill AIDA::IHistogram1D objects
27  * @see AIDA::IHistogram1D
28  * @param histo pointer to the histogram
29  * @param value value to be added to the histogram
30  * @param weight the "weight" assciated with this entry
31  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
32  * @date 2007-10-02
33  */
34 // ============================================================================
35 void Gaudi::Utils::Histos::fill( AIDA::IHistogram1D* histo, const double value, const double weight )
36 {
37  if ( histo ) {
38  histo->fill( value, weight );
39  }
40 }
41 // ============================================================================
42 /* simple function to fill AIDA::IHistogram2D objects
43  * @see AIDA::IHistogram2D
44  * @param histo pointer to the histogram
45  * @param valueX value to be added to the histogram
46  * @param valueY value to be added to the histogram
47  * @param weight the "weight" assciated with this entry
48  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
49  * @date 2007-10-02
50  */
51 // ============================================================================
52 void Gaudi::Utils::Histos::fill( AIDA::IHistogram2D* histo, const double valueX, const double valueY,
53  const double weight )
54 {
55  if ( histo ) {
56  histo->fill( valueX, valueY, weight );
57  }
58 }
59 // ============================================================================
60 /* simple function to fill AIDA::IHistogram3D objects
61  * @see AIDA::IHistogram3D
62  * @param histo pointer to the histogram
63  * @param valueX value to be added to the histogram
64  * @param valueY value to be added to the histogram
65  * @param valueZ value to be added to the histogram
66  * @param weight the "weight" assciated with this entry
67  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
68  * @date 2007-10-02
69  */
70 // ============================================================================
71 void Gaudi::Utils::Histos::fill( AIDA::IHistogram3D* histo, const double valueX, const double valueY,
72  const double valueZ, const double weight )
73 {
74  if ( histo ) {
75  histo->fill( valueX, valueY, valueZ, weight );
76  }
77 }
78 // ============================================================================
79 /* simple function to fill AIDA::IProfile1D objects
80  * @see AIDA::IProfile1D
81  * @param histo pointer to the histogram
82  * @param valueX value to be added to the histogram
83  * @param valueY value to be added to the histogram
84  * @param weight the "weight" assciated with this entry
85  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
86  * @date 2007-10-02
87  */
88 // ============================================================================
89 void Gaudi::Utils::Histos::fill( AIDA::IProfile1D* histo, const double valueX, const double valueY,
90  const double weight )
91 {
92  if ( histo ) {
93  histo->fill( valueX, valueY, weight );
94  }
95 }
96 // ============================================================================
97 /* simple function to fill AIDA::IProfile2D objects
98  * @see AIDA::IProfile2D
99  * @param histo pointer to the histogram
100  * @param valueX value to be added to the histogram
101  * @param valueY value to be added to the histogram
102  * @param valueZ value to be added to the histogram
103  * @param weight the "weight" assciated with this entry
104  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
105  * @date 2007-10-02
106  */
107 // ============================================================================
108 void Gaudi::Utils::Histos::fill( AIDA::IProfile2D* histo, const double valueX, const double valueY, const double valueZ,
109  const double weight )
110 {
111  if ( histo ) {
112  histo->fill( valueX, valueY, valueZ, weight );
113  }
114 }
115 // ============================================================================
116 namespace
117 {
118  inline std::string htitle_( const AIDA::IBaseHistogram* histo, const std::string& title )
119  {
120  return ( histo && title.empty() ) ? histo->title() : title;
121  }
122 }
123 // ======================================================================
124 // get the title
125 // ======================================================================
126 std::string Gaudi::Utils::Histos::htitle( const AIDA::IBaseHistogram* histo, const std::string& title )
127 {
128  return htitle_( histo, title );
129 }
130 // ======================================================================
131 // get the title
132 // ======================================================================
133 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram* histo, const std::string& title )
134 {
135  return htitle_( histo, title );
136 }
137 // ======================================================================
138 // get the title
139 // ======================================================================
140 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram1D* histo, const std::string& title )
141 {
142  return htitle_( histo, title );
143 }
144 // ======================================================================
145 // get the title
146 // ======================================================================
147 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram2D* histo, const std::string& title )
148 {
149  return htitle_( histo, title );
150 }
151 // ======================================================================
152 // get the title
153 // ======================================================================
154 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram3D* histo, const std::string& title )
155 {
156  return htitle_( histo, title );
157 }
158 // ======================================================================
159 // get the title
160 // ======================================================================
161 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile* histo, const std::string& title )
162 {
163  return htitle_( histo, title );
164 }
165 // ======================================================================
166 // get the title
167 // ======================================================================
168 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile1D* histo, const std::string& title )
169 {
170  return htitle_( histo, title );
171 }
172 // ======================================================================
173 // get the title
174 // ======================================================================
175 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile2D* histo, const std::string& title )
176 {
177  return htitle_( histo, title );
178 }
179 // ======================================================================
180 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram1D* histo ) { return histo; }
181 // ======================================================================
182 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram2D* histo ) { return histo; }
183 // ======================================================================
184 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram3D* histo ) { return histo; }
185 // ======================================================================
186 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IProfile1D* histo ) { return histo; }
187 // ======================================================================
188 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IProfile2D* histo ) { return histo; }
189 // ======================================================================
190 
191 // ============================================================================
192 // The END
193 // ============================================================================
GAUDI_API std::string htitle(const AIDA::IBaseHistogram *histo, const std::string &title="")
get the title
Definition: Fill.cpp:126
T empty(T...args)
GAUDI_API void fill(AIDA::IHistogram1D *histo, const double value, const double weight=1.0)
simple function to fill AIDA::IHistogram1D objects
Definition: Fill.cpp:35
STL class.
GAUDI_API AIDA::IBaseHistogram * toBase(AIDA::IHistogram1D *histo)
Definition: Fill.cpp:180