19 #include "TProfile2D.h"
20 #include "TBufferXML.h"
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"
48 typedef std::auto_ptr<TYPE> H ;
50 H operator() (
const std::string& input )
const
53 std::auto_ptr<TObject> obj ( TBufferXML::ConvertFromXML ( input.c_str() ) ) ;
54 if ( 0 == obj.get() ) {
return H() ; }
55 H histo ( dynamic_cast<TYPE*>( obj.get() ) ) ;
56 if ( 0 != histo.get() ) { obj.release() ; }
71 std::ostream& stream )
74 const TObject* obj = &histo ;
76 TString
s = TBufferXML::ConvertToXML ( const_cast<TObject*> ( obj ) ) ;
88 std::ostream& stream )
91 const TObject* obj = &histo ;
93 TString
s = TBufferXML::ConvertToXML ( const_cast<TObject*> ( obj ) ) ;
104 (
const TH3D& histo ,
105 std::ostream& stream )
108 const TObject* obj = &histo ;
110 TString
s = TBufferXML::ConvertToXML ( const_cast<TObject*> ( obj ) ) ;
121 (
const TH1F& histo ,
122 std::ostream& stream )
125 const TObject* obj = &histo ;
127 TString
s = TBufferXML::ConvertToXML ( const_cast<TObject*> ( obj ) ) ;
138 (
const TH2F& histo ,
139 std::ostream& stream )
142 const TObject* obj = &histo ;
144 TString
s = TBufferXML::ConvertToXML ( const_cast<TObject*> ( obj ) ) ;
155 (
const TH3F& histo ,
156 std::ostream& stream )
159 const TObject* obj = &histo ;
161 TString
s = TBufferXML::ConvertToXML ( const_cast<TObject*> ( obj ) ) ;
172 (
const TProfile& histo ,
173 std::ostream& stream )
176 const TObject* obj = &histo ;
178 TString
s = TBufferXML::ConvertToXML ( const_cast<TObject*> ( obj ) ) ;
189 (
const TProfile2D& histo ,
190 std::ostream& stream )
193 const TObject* obj = &histo ;
195 TString
s = TBufferXML::ConvertToXML ( const_cast<TObject*> ( obj ) ) ;
206 (
const AIDA::IHistogram1D& histo ,
207 std::ostream& stream )
210 AIDA::IHistogram1D* aida =
const_cast<AIDA::IHistogram1D*
> ( &histo ) ;
213 if ( 0 == root ) {
return stream ; }
215 return toXml ( *root , stream ) ;
224 (
const AIDA::IHistogram2D& histo ,
225 std::ostream& stream )
228 AIDA::IHistogram2D* aida =
const_cast<AIDA::IHistogram2D*
> ( &histo ) ;
231 if ( 0 == root ) {
return stream ; }
233 return toXml ( *root , stream ) ;
242 (
const AIDA::IHistogram3D& histo ,
243 std::ostream& stream )
246 AIDA::IHistogram3D* aida =
const_cast<AIDA::IHistogram3D*
> ( &histo ) ;
249 if ( 0 == root ) {
return stream ; }
251 return toXml ( *root , stream ) ;
260 (
const AIDA::IProfile1D& histo ,
261 std::ostream& stream )
264 AIDA::IProfile1D* aida =
const_cast<AIDA::IProfile1D*
> ( &histo ) ;
267 if ( 0 == root ) {
return stream ; }
269 return toXml ( *root , stream ) ;
278 (
const AIDA::IProfile2D& histo ,
279 std::ostream& stream )
282 AIDA::IProfile2D* aida =
const_cast<AIDA::IProfile2D*
> ( &histo ) ;
285 if ( 0 == root ) {
return stream ; }
287 return toXml ( *root , stream ) ;
297 ( TH1D& result ,
const std::string& input )
303 std::auto_ptr<TH1D> histo = _xml ( input ) ;
307 histo->Copy ( result ) ;
319 ( TH2D& result ,
const std::string& input )
325 std::auto_ptr<TH2D> histo = _xml ( input ) ;
329 histo->Copy ( result ) ;
341 ( TH3D& result ,
const std::string& input )
347 std::auto_ptr<TH3D> histo = _xml ( input ) ;
351 histo->Copy ( result ) ;
363 ( TH1F& result ,
const std::string& input )
369 std::auto_ptr<TH1F> histo = _xml ( input ) ;
373 histo->Copy ( result ) ;
385 ( TH2F& result ,
const std::string& input )
391 std::auto_ptr<TH2F> histo = _xml ( input ) ;
395 histo->Copy ( result ) ;
407 ( TH3F& result ,
const std::string& input )
413 std::auto_ptr<TH3F> histo = _xml ( input ) ;
417 histo->Copy ( result ) ;
429 ( TProfile& result ,
const std::string& input )
434 _Xml<TProfile> _xml ;
435 std::auto_ptr<TProfile> histo = _xml ( input ) ;
439 histo->Copy ( result ) ;
451 ( TProfile2D& result ,
const std::string& input )
456 _Xml<TProfile2D> _xml ;
457 std::auto_ptr<TProfile2D> histo = _xml ( input ) ;
461 histo->Copy ( result ) ;
475 ( TH1D*& result ,
const std::string& input )
477 if ( 0 != result ) {
return fromXml ( *result , input ) ; }
480 std::auto_ptr<TH1D> histo = _xml ( input ) ;
483 result = histo.release() ;
495 ( TH2D*& result ,
const std::string& input )
497 if ( 0 != result ) {
return fromXml ( *result , input ) ; }
500 std::auto_ptr<TH2D> histo = _xml ( input ) ;
503 result = histo.release() ;
515 ( TH3D*& result ,
const std::string& input )
517 if ( 0 != result ) {
return fromXml ( *result , input ) ; }
520 std::auto_ptr<TH3D> histo = _xml ( input ) ;
523 result = histo.release() ;
536 ( TProfile*& result ,
const std::string& input )
538 if ( 0 != result ) {
return fromXml ( *result , input ) ; }
540 _Xml<TProfile> _xml ;
541 std::auto_ptr<TProfile> histo = _xml ( input ) ;
544 result = histo.release() ;
556 ( TProfile2D*& result ,
const std::string& input )
558 if ( 0 != result ) {
return fromXml ( *result , input ) ; }
560 _Xml<TProfile2D> _xml ;
561 std::auto_ptr<TProfile2D> histo = _xml ( input ) ;
564 result = histo.release() ;
576 ( AIDA::IHistogram1D& result ,
const std::string& input )
581 return fromXml ( *root , input ) ;
591 ( AIDA::IHistogram2D& result ,
const std::string& input )
596 return fromXml ( *root , input ) ;
606 ( AIDA::IHistogram3D& result ,
const std::string& input )
611 return fromXml ( *root , input ) ;
621 ( AIDA::IProfile1D& result ,
const std::string& input )
626 return fromXml ( *root , input ) ;
636 ( AIDA::IProfile2D& result ,
const std::string& input )
641 return fromXml ( *root , input ) ;
GAUDI_API StatusCode fromXml(TH1D &result, const std::string &input)
parse the histogram from standard ROOT XML
This class is used for returning status codes from appropriate routines.
static TH1D * aida2root(AIDA::IHistogram1D *aida)
get the underlying pointer for 1D-histogram
GAUDI_API std::ostream & toXml(const TH1D &histo, std::ostream &stream)
stream the ROOT histogram into output stream as XML