Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-16 09:21:05

0001 /// \file
0002 /// \warning This is part of the %ROOT 7 prototype! It will change without notice. It might trigger earthquakes.
0003 /// Feedback is welcome!
0004 
0005 #ifndef ROOT_Hist_ConvertToTH1
0006 #define ROOT_Hist_ConvertToTH1
0007 
0008 #include <ROOT/RBinWithError.hxx>
0009 #include <ROOT/RHist.hxx>
0010 #include <ROOT/RHistEngine.hxx>
0011 
0012 class TH1C;
0013 class TH1S;
0014 class TH1I;
0015 class TH1L;
0016 class TH1F;
0017 class TH1D;
0018 
0019 #include <memory>
0020 
0021 namespace ROOT {
0022 namespace Experimental {
0023 namespace Hist {
0024 
0025 /// Convert a one-dimensional histogram to TH1C.
0026 ///
0027 /// \copydetails ConvertToTH1I(const RHistEngine<int> &engine)
0028 std::unique_ptr<TH1C> ConvertToTH1C(const RHistEngine<char> &engine);
0029 
0030 /// Convert a one-dimensional histogram to TH1S.
0031 ///
0032 /// \copydetails ConvertToTH1I(const RHistEngine<int> &engine)
0033 std::unique_ptr<TH1S> ConvertToTH1S(const RHistEngine<short> &engine);
0034 
0035 /// Convert a one-dimensional histogram to TH1I.
0036 ///
0037 /// As RHistEngine does not have global statistics, the number of entries and the total sum of weights will be unset.
0038 ///
0039 /// Throws an exception if the histogram has more than one dimension.
0040 ///
0041 /// \param[in] engine the RHistEngine to convert
0042 /// \return the converted TH1
0043 std::unique_ptr<TH1I> ConvertToTH1I(const RHistEngine<int> &engine);
0044 
0045 /// Convert a one-dimensional histogram to TH1L.
0046 ///
0047 /// \copydetails ConvertToTH1I(const RHistEngine<int> &engine)
0048 std::unique_ptr<TH1L> ConvertToTH1L(const RHistEngine<long> &engine);
0049 
0050 /// Convert a one-dimensional histogram to TH1L.
0051 ///
0052 /// \copydetails ConvertToTH1I(const RHistEngine<int> &engine)
0053 std::unique_ptr<TH1L> ConvertToTH1L(const RHistEngine<long long> &engine);
0054 
0055 /// Convert a one-dimensional histogram to TH1F.
0056 ///
0057 /// \copydetails ConvertToTH1I(const RHistEngine<int> &engine)
0058 std::unique_ptr<TH1F> ConvertToTH1F(const RHistEngine<float> &engine);
0059 
0060 /// Convert a one-dimensional histogram to TH1D.
0061 ///
0062 /// \copydetails ConvertToTH1I(const RHistEngine<int> &engine)
0063 std::unique_ptr<TH1D> ConvertToTH1D(const RHistEngine<double> &engine);
0064 
0065 /// Convert a one-dimensional histogram to TH1D.
0066 ///
0067 /// \copydetails ConvertToTH1I(const RHistEngine<int> &engine)
0068 std::unique_ptr<TH1D> ConvertToTH1D(const RHistEngine<RBinWithError> &engine);
0069 
0070 /// Convert a one-dimensional histogram to TH1C.
0071 ///
0072 /// \copydetails ConvertToTH1I(const RHist<int> &hist)
0073 std::unique_ptr<TH1C> ConvertToTH1C(const RHist<char> &hist);
0074 
0075 /// Convert a one-dimensional histogram to TH1S.
0076 ///
0077 /// \copydetails ConvertToTH1I(const RHist<int> &hist)
0078 std::unique_ptr<TH1S> ConvertToTH1S(const RHist<short> &hist);
0079 
0080 /// Convert a one-dimensional histogram to TH1I.
0081 ///
0082 /// If the RHistStats are tainted, for example after setting bin contents, the number of entries and the total sum of
0083 /// weights will be unset.
0084 ///
0085 /// Throws an exception if the histogram has more than one dimension.
0086 ///
0087 /// \param[in] hist the RHist to convert
0088 /// \return the converted TH1
0089 std::unique_ptr<TH1I> ConvertToTH1I(const RHist<int> &hist);
0090 
0091 /// Convert a one-dimensional histogram to TH1L.
0092 ///
0093 /// \copydetails ConvertToTH1I(const RHist<int> &hist)
0094 std::unique_ptr<TH1L> ConvertToTH1L(const RHist<long> &hist);
0095 
0096 /// Convert a one-dimensional histogram to TH1L.
0097 ///
0098 /// \copydetails ConvertToTH1I(const RHist<int> &hist)
0099 std::unique_ptr<TH1L> ConvertToTH1L(const RHist<long long> &hist);
0100 
0101 /// Convert a one-dimensional histogram to TH1F.
0102 ///
0103 /// \copydetails ConvertToTH1I(const RHist<int> &hist)
0104 std::unique_ptr<TH1F> ConvertToTH1F(const RHist<float> &hist);
0105 
0106 /// Convert a one-dimensional histogram to TH1D.
0107 ///
0108 /// \copydetails ConvertToTH1I(const RHist<int> &hist)
0109 std::unique_ptr<TH1D> ConvertToTH1D(const RHist<double> &hist);
0110 
0111 /// Convert a one-dimensional histogram to TH1D.
0112 ///
0113 /// \copydetails ConvertToTH1I(const RHist<int> &hist)
0114 std::unique_ptr<TH1D> ConvertToTH1D(const RHist<RBinWithError> &hist);
0115 
0116 } // namespace Hist
0117 } // namespace Experimental
0118 } // namespace ROOT
0119 
0120 #endif