All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 // ============================================================================
36 ( AIDA::IHistogram1D* histo ,
37  const double value ,
38  const double weight )
39 {
40  if ( histo ) { histo->fill ( value , weight ) ; }
41 }
42 // ============================================================================
43 /* simple function to fill AIDA::IHistogram2D objects
44  * @see AIDA::IHistogram2D
45  * @param histo pointer to the histogram
46  * @param valueX value to be added to the histogram
47  * @param valueY value to be added to the histogram
48  * @param weight the "weight" assciated with this entry
49  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
50  * @date 2007-10-02
51  */
52 // ============================================================================
54 ( AIDA::IHistogram2D* histo ,
55  const double valueX ,
56  const double valueY ,
57  const double weight )
58 {
59  if ( histo ) { histo -> fill ( valueX , valueY , weight ) ; }
60 }
61 // ============================================================================
62 /* simple function to fill AIDA::IHistogram3D objects
63  * @see AIDA::IHistogram3D
64  * @param histo pointer to the histogram
65  * @param valueX value to be added to the histogram
66  * @param valueY value to be added to the histogram
67  * @param valueZ value to be added to the histogram
68  * @param weight the "weight" assciated with this entry
69  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
70  * @date 2007-10-02
71  */
72 // ============================================================================
74 ( AIDA::IHistogram3D* histo ,
75  const double valueX ,
76  const double valueY ,
77  const double valueZ ,
78  const double weight )
79 {
80  if ( histo ) { histo -> fill ( valueX , valueY , valueZ , weight ) ; }
81 }
82 // ============================================================================
83 /* simple function to fill AIDA::IProfile1D objects
84  * @see AIDA::IProfile1D
85  * @param histo pointer to the histogram
86  * @param valueX value to be added to the histogram
87  * @param valueY value to be added to the histogram
88  * @param weight the "weight" assciated with this entry
89  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
90  * @date 2007-10-02
91  */
92 // ============================================================================
94 ( AIDA::IProfile1D* histo ,
95  const double valueX ,
96  const double valueY ,
97  const double weight )
98 {
99  if ( histo ) { histo -> fill ( valueX , valueY , weight ) ; }
100 }
101 // ============================================================================
102 /* simple function to fill AIDA::IProfile2D objects
103  * @see AIDA::IProfile2D
104  * @param histo pointer to the histogram
105  * @param valueX value to be added to the histogram
106  * @param valueY value to be added to the histogram
107  * @param valueZ value to be added to the histogram
108  * @param weight the "weight" assciated with this entry
109  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
110  * @date 2007-10-02
111  */
112 // ============================================================================
114 ( AIDA::IProfile2D* histo ,
115  const double valueX ,
116  const double valueY ,
117  const double valueZ ,
118  const double weight )
119 {
120  if ( histo ) { histo -> fill ( valueX , valueY , valueZ , weight ) ; }
121 }
122 // ============================================================================
123 namespace
124 {
125  inline
126  std::string htitle_
127  ( const AIDA::IBaseHistogram* histo ,
128  const std::string& title )
129  {
130  return
131  ( histo && title.empty() ) ? histo->title() : title ;
132  }
133 }
134 // ======================================================================
135 // get the title
136 // ======================================================================
138 ( const AIDA::IBaseHistogram* histo ,
139  const std::string& title )
140 { return htitle_ ( histo , title ) ; }
141 // ======================================================================
142 // get the title
143 // ======================================================================
145 ( const AIDA::IHistogram* histo ,
146  const std::string& title )
147 { return htitle_ ( histo , title ) ; }
148 // ======================================================================
149 // get the title
150 // ======================================================================
152 ( const AIDA::IHistogram1D* histo ,
153  const std::string& title )
154 { return htitle_ ( histo , title ) ; }
155 // ======================================================================
156 // get the title
157 // ======================================================================
159 ( const AIDA::IHistogram2D* histo ,
160  const std::string& title )
161 { return htitle_ ( histo , title ) ; }
162 // ======================================================================
163 // get the title
164 // ======================================================================
166 ( const AIDA::IHistogram3D* histo ,
167  const std::string& title )
168 { return htitle_ ( histo , title ) ; }
169 // ======================================================================
170 // get the title
171 // ======================================================================
173 ( const AIDA::IProfile* histo ,
174  const std::string& title )
175 { return htitle_ ( histo , title ) ; }
176 // ======================================================================
177 // get the title
178 // ======================================================================
180 ( const AIDA::IProfile1D* histo ,
181  const std::string& title )
182 { return htitle_ ( histo , title ) ; }
183 // ======================================================================
184 // get the title
185 // ======================================================================
187 ( const AIDA::IProfile2D* histo ,
188  const std::string& title )
189 { return htitle_ ( histo , title ) ; }
190 // ======================================================================
191 AIDA::IBaseHistogram*
193 ( AIDA::IHistogram1D* histo ) { return histo ; }
194 // ======================================================================
195 AIDA::IBaseHistogram*
197 ( AIDA::IHistogram2D* histo ) { return histo ; }
198 // ======================================================================
199 AIDA::IBaseHistogram*
201 ( AIDA::IHistogram3D* histo ) { return histo ; }
202 // ======================================================================
203 AIDA::IBaseHistogram*
205 ( AIDA::IProfile1D* histo ) { return histo ; }
206 // ======================================================================
207 AIDA::IBaseHistogram*
209 ( AIDA::IProfile2D* histo ) { return histo ; }
210 // ======================================================================
211 
212 // ============================================================================
213 // The END
214 // ============================================================================
GAUDI_API std::string htitle(const AIDA::IBaseHistogram *histo, const std::string &title="")
get the title
Definition: Fill.cpp:138
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:36
STL class.
GAUDI_API AIDA::IBaseHistogram * toBase(AIDA::IHistogram1D *histo)
Definition: Fill.cpp:193