Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
HistoStrings.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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 #pragma once
12 // ============================================================================
13 // Include files
14 // ============================================================================
15 // STD & STL
16 // ============================================================================
17 #include <iosfwd>
18 #include <string>
19 // ============================================================================
20 // GaudiKernel
21 // ============================================================================
22 #include <GaudiKernel/StatusCode.h>
23 // ============================================================================
24 // forward declarations
25 // ============================================================================
26 // Forward declarations
27 // ============================================================================
28 // AIDA
29 // ============================================================================
30 namespace AIDA {
31  class IHistogram1D;
32  class IHistogram2D;
33  class IHistogram3D;
34  class IProfile1D;
35  class IProfile2D;
36 } // namespace AIDA
37 // ============================================================================
38 // ROOT
39 // ============================================================================
40 class TH1D; // ROOT
41 class TH2D; // ROOT
42 class TH3D; // ROOT
43 class TProfile; // ROOT
44 class TProfile2D; // ROOT
45 // ============================================================================
46 namespace Gaudi {
47  // ==========================================================================
48  namespace Utils {
49  // ========================================================================
50  namespace Histos {
51  // ======================================================================
58  // ====================================================================
59  public:
60  // ====================================================================
68  static std::string toString( const TH1D& histo, const bool asXML = false );
69  // ====================================================================
77  static std::string toString( const TH2D& histo, const bool asXML = false );
78  // ====================================================================
86  static std::string toString( const AIDA::IHistogram1D& histo, const bool asXML = false );
87  // ====================================================================
95  static std::string toString( const AIDA::IHistogram2D& histo, const bool asXML = false );
96  // ====================================================================
102  static StatusCode fromString( TH1D& result, const std::string& input );
103  // ====================================================================
109  static StatusCode fromString( AIDA::IHistogram1D& result, const std::string& input );
110  // ====================================================================
116  static StatusCode fromString( TH2D& result, const std::string& input );
117  // ====================================================================
123  static StatusCode fromString( AIDA::IHistogram2D& result, const std::string& input );
124  // ====================================================================
125  static std::string toXml( const TH1D& histo );
126  static std::string toXml( const TH2D& histo );
127  static std::string toXml( const TH3D& histo );
128  static std::string toXml( const TProfile& histo );
129  static std::string toXml( const TProfile2D& histo );
130  // ====================================================================
131  static std::string toXml( const AIDA::IHistogram1D& histo );
132  static std::string toXml( const AIDA::IHistogram2D& histo );
133  static std::string toXml( const AIDA::IHistogram3D& histo );
134  static std::string toXml( const AIDA::IProfile1D& histo );
135  static std::string toXml( const AIDA::IProfile2D& histo );
136  // ====================================================================
137  static StatusCode fromXml( TH1D& result, const std::string& input );
138  static StatusCode fromXml( TH2D& result, const std::string& input );
139  static StatusCode fromXml( TH3D& result, const std::string& input );
140  static StatusCode fromXml( TProfile& result, const std::string& input );
141  static StatusCode fromXml( TProfile2D& result, const std::string& input );
142  // ====================================================================
143  static StatusCode fromXml( AIDA::IHistogram1D& result, const std::string& input );
144  static StatusCode fromXml( AIDA::IHistogram2D& result, const std::string& input );
145  static StatusCode fromXml( AIDA::IHistogram3D& result, const std::string& input );
146  static StatusCode fromXml( AIDA::IProfile1D& result, const std::string& input );
147  static StatusCode fromXml( AIDA::IProfile2D& result, const std::string& input );
148  // ====================================================================
149  };
150  // ======================================================================
151  } // namespace Histos
152  // ========================================================================
153  } // namespace Utils
154  // ==========================================================================
155 } // end of namespace Gaudi
156 // ============================================================================
157 // The END
158 // ============================================================================
AIDA
Definition: Annotation.h:21
StatusCode.h
StatusCode
Definition: StatusCode.h:64
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:326
Gaudi::Utils::Histos::fromXml
GAUDI_API StatusCode fromXml(TH1D &result, std::string_view input)
parse the histogram from standard ROOT XML
Definition: HistoXML.cpp:199
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49
Gaudi::Utils::Histos::HistoStrings
Definition: HistoStrings.h:57
Gaudi::Utils::Histos::toXml
GAUDI_API std::ostream & toXml(const TH1D &histo, std::ostream &stream)
stream the ROOT histogram into output stream as XML
Definition: HistoXML.cpp:76