![]() |
|
|
Generated: 8 Jan 2009 |
00001 // $Id: Aida2ROOT.cpp,v 1.3 2007/08/06 14:49:36 hmd Exp $ 00002 // ============================================================================ 00003 // Include files 00004 // ============================================================================ 00005 // AIDA 00006 // ============================================================================ 00007 #include "AIDA/IHistogram1D.h" 00008 #include "AIDA/IHistogram2D.h" 00009 #include "AIDA/IHistogram3D.h" 00010 #include "AIDA/IProfile1D.h" 00011 #include "AIDA/IProfile2D.h" 00012 // ============================================================================ 00013 // ROOT 00014 // ============================================================================ 00015 #include "TH1D.h" 00016 #include "TH2D.h" 00017 #include "TH3D.h" 00018 #include "TProfile.h" 00019 #include "TProfile2D.h" 00020 // ============================================================================ 00021 // GaudiKernel 00022 // ============================================================================ 00023 #include "GaudiKernel/HistogramBase.h" 00024 // ============================================================================ 00025 // GaudiAlg 00026 // ============================================================================ 00027 #include "GaudiUtils/Aida2ROOT.h" 00028 // ============================================================================ 00034 // ============================================================================ 00035 // get the underlying pointer for 1D-histogram 00036 // ============================================================================ 00037 TH1D* Gaudi::Utils::Aida2ROOT::aida2root ( AIDA::IHistogram1D* aida ) 00038 { 00039 if ( 0 == aida ) { return 0 ; } 00040 Gaudi::HistogramBase* base = dynamic_cast<Gaudi::HistogramBase*> ( aida ) ; 00041 if ( 0 == base ) { return 0 ; } 00042 return dynamic_cast<TH1D*>( base->representation() ) ; 00043 } 00044 // ============================================================================ 00045 // get the underlying pointer for 2D-histogram 00046 // ============================================================================ 00047 TH2D* Gaudi::Utils::Aida2ROOT::aida2root ( AIDA::IHistogram2D* aida ) 00048 { 00049 if ( 0 == aida ) { return 0 ; } 00050 Gaudi::HistogramBase* base = dynamic_cast<Gaudi::HistogramBase*> ( aida ) ; 00051 if ( 0 == base ) { return 0 ; } 00052 return dynamic_cast<TH2D*>( base->representation() ) ; 00053 } 00054 // ============================================================================ 00055 // get the underlying pointer for 3D-histogram 00056 // ============================================================================ 00057 TH3D* Gaudi::Utils::Aida2ROOT::aida2root ( AIDA::IHistogram3D* aida ) 00058 { 00059 if ( 0 == aida ) { return 0 ; } 00060 Gaudi::HistogramBase* base = dynamic_cast<Gaudi::HistogramBase*> ( aida ) ; 00061 if ( 0 == base ) { return 0 ; } 00062 return dynamic_cast<TH3D*>( base->representation() ) ; 00063 } 00064 // ============================================================================ 00065 // get the underlying pointer for 1D-profile 00066 // ============================================================================ 00067 TProfile* Gaudi::Utils::Aida2ROOT::aida2root ( AIDA::IProfile1D* aida ) 00068 { 00069 if ( 0 == aida ) { return 0 ; } 00070 Gaudi::HistogramBase* base = dynamic_cast<Gaudi::HistogramBase*> ( aida ) ; 00071 if ( 0 == base ) { return 0 ; } 00072 return dynamic_cast<TProfile*>( base->representation() ) ; 00073 } 00074 // ============================================================================ 00075 // get the underlying pointer for 2D-profile 00076 // ============================================================================ 00077 TProfile2D* Gaudi::Utils::Aida2ROOT::aida2root ( AIDA::IProfile2D* aida ) 00078 { 00079 if ( 0 == aida ) { return 0 ; } 00080 Gaudi::HistogramBase* base = dynamic_cast<Gaudi::HistogramBase*> ( aida ) ; 00081 if ( 0 == base ) { return 0 ; } 00082 return dynamic_cast<TProfile2D*>( base->representation() ) ; 00083 } 00084 // ============================================================================ 00085 // get root representation for other cases 00086 // ============================================================================ 00087 TObject* Gaudi::Utils::Aida2ROOT::aida2root ( AIDA::IHistogram* aida ) 00088 { 00089 if ( 0 == aida ) { return 0 ; } 00090 Gaudi::HistogramBase* base = dynamic_cast<Gaudi::HistogramBase*> ( aida ) ; 00091 if ( 0 == base ) { return 0 ; } 00092 return base->representation() ; 00093 } 00094 // ============================================================================ 00095 // The END 00096 // ============================================================================