Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v38r0 (2143aa4c)
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 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 // ============================================================================
12 // Include files
13 // ============================================================================
14 // STD& STL
15 // ============================================================================
16 #include <string>
17 // ============================================================================
18 // GaudiAlg
19 // ============================================================================
20 #include "GaudiAlg/Fill.h"
21 // ============================================================================
22 // AIDA
23 // ============================================================================
24 #include "AIDA/IHistogram1D.h"
25 #include "AIDA/IHistogram2D.h"
26 #include "AIDA/IHistogram3D.h"
27 #include "AIDA/IProfile1D.h"
28 #include "AIDA/IProfile2D.h"
29 // ============================================================================
35 // ============================================================================
36 /* simple function to fill AIDA::IHistogram1D objects
37  * @see AIDA::IHistogram1D
38  * @param histo pointer to the histogram
39  * @param value value to be added to the histogram
40  * @param weight the "weight" assciated with this entry
41  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
42  * @date 2007-10-02
43  */
44 // ============================================================================
45 void Gaudi::Utils::Histos::fill( AIDA::IHistogram1D* histo, const double value, const double weight ) {
46  if ( histo ) { histo->fill( value, weight ); }
47 }
48 // ============================================================================
49 /* simple function to fill AIDA::IHistogram2D objects
50  * @see AIDA::IHistogram2D
51  * @param histo pointer to the histogram
52  * @param valueX value to be added to the histogram
53  * @param valueY value to be added to the histogram
54  * @param weight the "weight" assciated with this entry
55  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
56  * @date 2007-10-02
57  */
58 // ============================================================================
59 void Gaudi::Utils::Histos::fill( AIDA::IHistogram2D* histo, const double valueX, const double valueY,
60  const double weight ) {
61  if ( histo ) { histo->fill( valueX, valueY, weight ); }
62 }
63 // ============================================================================
64 /* simple function to fill AIDA::IHistogram3D objects
65  * @see AIDA::IHistogram3D
66  * @param histo pointer to the histogram
67  * @param valueX value to be added to the histogram
68  * @param valueY value to be added to the histogram
69  * @param valueZ value to be added to the histogram
70  * @param weight the "weight" assciated with this entry
71  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
72  * @date 2007-10-02
73  */
74 // ============================================================================
75 void Gaudi::Utils::Histos::fill( AIDA::IHistogram3D* histo, const double valueX, const double valueY,
76  const double valueZ, const double weight ) {
77  if ( histo ) { histo->fill( valueX, valueY, valueZ, weight ); }
78 }
79 // ============================================================================
80 /* simple function to fill AIDA::IProfile1D objects
81  * @see AIDA::IProfile1D
82  * @param histo pointer to the histogram
83  * @param valueX value to be added to the histogram
84  * @param valueY value to be added to the histogram
85  * @param weight the "weight" assciated with this entry
86  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
87  * @date 2007-10-02
88  */
89 // ============================================================================
90 void Gaudi::Utils::Histos::fill( AIDA::IProfile1D* histo, const double valueX, const double valueY,
91  const double weight ) {
92  if ( histo ) { histo->fill( valueX, valueY, weight ); }
93 }
94 // ============================================================================
95 /* simple function to fill AIDA::IProfile2D objects
96  * @see AIDA::IProfile2D
97  * @param histo pointer to the histogram
98  * @param valueX value to be added to the histogram
99  * @param valueY value to be added to the histogram
100  * @param valueZ value to be added to the histogram
101  * @param weight the "weight" assciated with this entry
102  * @author Vanya BELYAEV ibelyaev@physics.syr.edu
103  * @date 2007-10-02
104  */
105 // ============================================================================
106 void Gaudi::Utils::Histos::fill( AIDA::IProfile2D* histo, const double valueX, const double valueY, const double valueZ,
107  const double weight ) {
108  if ( histo ) { histo->fill( valueX, valueY, valueZ, weight ); }
109 }
110 // ============================================================================
111 namespace {
112  inline std::string htitle_( const AIDA::IBaseHistogram* histo, const std::string& title ) {
113  return ( histo && title.empty() ) ? histo->title() : title;
114  }
115 } // namespace
116 // ======================================================================
117 // get the title
118 // ======================================================================
119 std::string Gaudi::Utils::Histos::htitle( const AIDA::IBaseHistogram* histo, const std::string& title ) {
120  return htitle_( histo, title );
121 }
122 // ======================================================================
123 // get the title
124 // ======================================================================
125 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram* histo, const std::string& title ) {
126  return htitle_( histo, title );
127 }
128 // ======================================================================
129 // get the title
130 // ======================================================================
131 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram1D* histo, const std::string& title ) {
132  return htitle_( histo, title );
133 }
134 // ======================================================================
135 // get the title
136 // ======================================================================
137 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram2D* histo, const std::string& title ) {
138  return htitle_( histo, title );
139 }
140 // ======================================================================
141 // get the title
142 // ======================================================================
143 std::string Gaudi::Utils::Histos::htitle( const AIDA::IHistogram3D* histo, const std::string& title ) {
144  return htitle_( histo, title );
145 }
146 // ======================================================================
147 // get the title
148 // ======================================================================
149 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile* histo, const std::string& title ) {
150  return htitle_( histo, title );
151 }
152 // ======================================================================
153 // get the title
154 // ======================================================================
155 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile1D* histo, const std::string& title ) {
156  return htitle_( histo, title );
157 }
158 // ======================================================================
159 // get the title
160 // ======================================================================
161 std::string Gaudi::Utils::Histos::htitle( const AIDA::IProfile2D* histo, const std::string& title ) {
162  return htitle_( histo, title );
163 }
164 // ======================================================================
165 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram1D* histo ) { return histo; }
166 // ======================================================================
167 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram2D* histo ) { return histo; }
168 // ======================================================================
169 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IHistogram3D* histo ) { return histo; }
170 // ======================================================================
171 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IProfile1D* histo ) { return histo; }
172 // ======================================================================
173 AIDA::IBaseHistogram* Gaudi::Utils::Histos::toBase( AIDA::IProfile2D* histo ) { return histo; }
174 // ======================================================================
175 
176 // ============================================================================
177 // The END
178 // ============================================================================
std::string
STL class.
Gaudi::Utils::Histos::toBase
GAUDI_API AIDA::IBaseHistogram * toBase(AIDA::IHistogram1D *histo)
Definition: Fill.cpp:165
Gaudi::Utils::Histos::htitle
GAUDI_API std::string htitle(const AIDA::IBaseHistogram *histo, const std::string &title="")
get the title
Definition: Fill.cpp:119
Fill.h
std::string::empty
T empty(T... args)
Gaudi::Utils::Histos::fill
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:45