Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
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 // ============================================================================
35 void Gaudi::Utils::Histos::fill( AIDA::IHistogram1D* histo, const double value, const double weight ) {
36  if ( histo ) { histo->fill( value, weight ); }
37 }
38 // ============================================================================
39 /* simple function to fill AIDA::IHistogram2D objects
40  * @see AIDA::IHistogram2D
41  * @param histo pointer to the histogram
42  * @param valueX value to be added to the histogram
43  * @param valueY value to be added to the histogram
44  * @param weight the "weight" assciated with this entry
45  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
46  * @date 2007-10-02
47  */
48 // ============================================================================
49 void Gaudi::Utils::Histos::fill( AIDA::IHistogram2D* histo, const double valueX, const double valueY,
50  const double weight ) {
51  if ( histo ) { histo->fill( valueX, valueY, weight ); }
52 }
53 // ============================================================================
54 /* simple function to fill AIDA::IHistogram3D objects
55  * @see AIDA::IHistogram3D
56  * @param histo pointer to the histogram
57  * @param valueX value to be added to the histogram
58  * @param valueY value to be added to the histogram
59  * @param valueZ value to be added to the histogram
60  * @param weight the "weight" assciated with this entry
61  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
62  * @date 2007-10-02
63  */
64 // ============================================================================
65 void Gaudi::Utils::Histos::fill( AIDA::IHistogram3D* histo, const double valueX, const double valueY,
66  const double valueZ, const double weight ) {
67  if ( histo ) { histo->fill( valueX, valueY, valueZ, weight ); }
68 }
69 // ============================================================================
70 /* simple function to fill AIDA::IProfile1D objects
71  * @see AIDA::IProfile1D
72  * @param histo pointer to the histogram
73  * @param valueX value to be added to the histogram
74  * @param valueY value to be added to the histogram
75  * @param weight the "weight" assciated with this entry
76  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
77  * @date 2007-10-02
78  */
79 // ============================================================================
80 void Gaudi::Utils::Histos::fill( AIDA::IProfile1D* histo, const double valueX, const double valueY,
81  const double weight ) {
82  if ( histo ) { histo->fill( valueX, valueY, weight ); }
83 }
84 // ============================================================================
85 /* simple function to fill AIDA::IProfile2D objects
86  * @see AIDA::IProfile2D
87  * @param histo pointer to the histogram
88  * @param valueX value to be added to the histogram
89  * @param valueY value to be added to the histogram
90  * @param valueZ value to be added to the histogram
91  * @param weight the "weight" assciated with this entry
92  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
93  * @date 2007-10-02
94  */
95 // ============================================================================
96 void Gaudi::Utils::Histos::fill( AIDA::IProfile2D* histo, const double valueX, const double valueY, const double valueZ,
97  const double weight ) {
98  if ( histo ) { histo->fill( valueX, valueY, valueZ, weight ); }
99 }
100 // ============================================================================
101 namespace {
102  inline std::string htitle_( const AIDA::IBaseHistogram* histo, const std::string& title ) {
103  return ( histo && title.empty() ) ? histo->title() : title;
104  }
105 } // namespace
106 // ======================================================================
107 // get the title
108 // ======================================================================
109 std::string Gaudi::Utils::Histos::htitle( const AIDA::IBaseHistogram* histo, const std::string& title ) {
110  return htitle_( histo, title );
111 }
112 // ======================================================================
113 // get the title
114 // ======================================================================
115 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram* histo, const std::string& title ) {
116  return htitle_( histo, title );
117 }
118 // ======================================================================
119 // get the title
120 // ======================================================================
121 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram1D* histo, const std::string& title ) {
122  return htitle_( histo, title );
123 }
124 // ======================================================================
125 // get the title
126 // ======================================================================
127 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram2D* histo, const std::string& title ) {
128  return htitle_( histo, title );
129 }
130 // ======================================================================
131 // get the title
132 // ======================================================================
133 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram3D* histo, const std::string& title ) {
134  return htitle_( histo, title );
135 }
136 // ======================================================================
137 // get the title
138 // ======================================================================
139 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile* histo, const std::string& title ) {
140  return htitle_( histo, title );
141 }
142 // ======================================================================
143 // get the title
144 // ======================================================================
145 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile1D* histo, const std::string& title ) {
146  return htitle_( histo, title );
147 }
148 // ======================================================================
149 // get the title
150 // ======================================================================
151 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile2D* histo, const std::string& title ) {
152  return htitle_( histo, title );
153 }
154 // ======================================================================
155 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram1D* histo ) { return histo; }
156 // ======================================================================
157 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram2D* histo ) { return histo; }
158 // ======================================================================
159 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram3D* histo ) { return histo; }
160 // ======================================================================
161 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IProfile1D* histo ) { return histo; }
162 // ======================================================================
163 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IProfile2D* histo ) { return histo; }
164 // ======================================================================
165 
166 // ============================================================================
167 // The END
168 // ============================================================================
GAUDI_API std::string htitle(const AIDA::IBaseHistogram *histo, const std::string &title="")
get the title
Definition: Fill.cpp:109
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:155