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