20#include <TBufferXML.h>
29#include <TProfile2D.h>
33#include <AIDA/IHistogram1D.h>
34#include <AIDA/IHistogram2D.h>
35#include <AIDA/IHistogram3D.h>
36#include <AIDA/IProfile1D.h>
37#include <AIDA/IProfile2D.h>
54 template <
typename TYPE>
55 std::unique_ptr<TYPE> _Xml( std::string_view input ) {
57 std::string
s{ input };
59 std::unique_ptr<TObject> obj{ TBufferXML::ConvertFromXML(
s.c_str() ) };
60 TYPE* histo = ( obj ?
dynamic_cast<TYPE*
>( obj.get() ) :
nullptr );
65 return std::unique_ptr<TYPE>{ histo ? ( obj.release(), histo ) :
nullptr };
77 return stream << TBufferXML::ConvertToXML( &histo );
86 return stream << TBufferXML::ConvertToXML( &histo );
95 return stream << TBufferXML::ConvertToXML( &histo );
104 return stream << TBufferXML::ConvertToXML( &histo );
113 return stream << TBufferXML::ConvertToXML( &histo );
122 return stream << TBufferXML::ConvertToXML( &histo );
131 return stream << TBufferXML::ConvertToXML( &histo );
140 return stream << TBufferXML::ConvertToXML( &histo );
150 return root ?
toXml( *root, stream ) : stream;
160 return root ?
toXml( *root, stream ) : stream;
170 return root ?
toXml( *root, stream ) : stream;
180 return root ?
toXml( *root, stream ) : stream;
190 return root ?
toXml( *root, stream ) : stream;
204 auto histo = _Xml<TH1D>( input );
207 histo->Copy( result );
222 auto histo = _Xml<TH2D>( input );
225 histo->Copy( result );
240 auto histo = _Xml<TH3D>( input );
243 histo->Copy( result );
258 auto histo = _Xml<TH1F>( input );
261 histo->Copy( result );
276 auto histo = _Xml<TH2F>( input );
279 histo->Copy( result );
294 auto histo = _Xml<TH3F>( input );
297 histo->Copy( result );
312 auto histo = _Xml<TProfile>( input );
315 histo->Copy( result );
330 auto histo = _Xml<TProfile2D>( input );
333 histo->Copy( result );
346 if ( result ) {
return fromXml( *result, input ); }
348 auto histo = _Xml<TH1D>( input );
351 result = histo.release();
363 if ( result ) {
return fromXml( *result, input ); }
365 auto histo = _Xml<TH2D>( input );
368 result = histo.release();
380 if ( result ) {
return fromXml( *result, input ); }
382 auto histo = _Xml<TH3D>( input );
385 result = histo.release();
398 if ( result ) {
return fromXml( *result, input ); }
400 auto histo = _Xml<TProfile>( input );
403 result = histo.release();
415 if ( result ) {
return fromXml( *result, input ); }
417 auto histo = _Xml<TProfile2D>( input );
420 result = histo.release();
static TH1D * aida2root(AIDA::IHistogram1D *aida)
get the underlying pointer for 1D-histogram
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
GAUDI_API StatusCode fromXml(TH1D &result, std::string_view input)
parse the histogram from standard ROOT XML
GAUDI_API std::ostream & toXml(const TH1D &histo, std::ostream &stream)
stream the ROOT histogram into output stream as XML