SFrame 3.6
plug-ins/include/SToolBase.icc
Go to the documentation of this file.
00001 // Dear emacs, this is -*- c++ -*-
00002 // $Id: SToolBase.icc 275 2011-10-11 08:43:24Z krasznaa $
00003 /***************************************************************************
00004  * @Project: SFrame - ROOT-based analysis framework for ATLAS
00005  * @Package: Plug-ins
00006  *
00007  * @author Stefan Ask       <Stefan.Ask@cern.ch>           - Manchester
00008  * @author David Berge      <David.Berge@cern.ch>          - CERN
00009  * @author Johannes Haller  <Johannes.Haller@cern.ch>      - Hamburg
00010  * @author A. Krasznahorkay <Attila.Krasznahorkay@cern.ch> - CERN/Debrecen
00011  *
00012  ***************************************************************************/
00013 
00014 #ifndef SFRAME_PLUGINS_SToolBase_ICC
00015 #define SFRAME_PLUGINS_SToolBase_ICC
00016 
00017 template< class Type >
00018 SToolBaseT< Type >::SToolBaseT()
00019    : m_logger( "SToolBase" ), m_parent( 0 ) {
00020 
00021 }
00022 
00023 template< class Type >
00024 SToolBaseT< Type >::SToolBaseT( ParentType* parent )
00025    : m_logger( "SToolBase" ), m_parent( parent ) {
00026 
00027 }
00028 
00029 template< class Type >
00030 typename SToolBaseT< Type >::ParentType* SToolBaseT< Type >::GetParent() const {
00031 
00032    // Print a warning if somebody tries to do something with the tool without
00033    // giving it a valid parent:
00034    if( ! m_parent ) {
00035       REPORT_ERROR( "No parent has been specified for the tool. The code is probably "
00036                     "going to crash!" );
00037    }
00038 
00039    return m_parent;
00040 }
00041 
00042 template< class Type >
00043 void SToolBaseT< Type >::SetParent( typename SToolBaseT< Type >::ParentType* parent ) {
00044 
00045    m_parent = parent;
00046    return;
00047 }
00048 
00049 template< class Type >
00050 template< class T >
00051 T* SToolBaseT< Type >::Book( const T& histo, const char* directory ) throw( SError ) {
00052 
00053    return GetParent()->template Book( histo, directory );
00054 }
00055 
00056 template< class Type >
00057 template< class T >
00058 T* SToolBaseT< Type >::Retrieve( const char* name,
00059                                  const char* directory,
00060                                  Bool_t outputOnly ) throw( SError ) {
00061 
00062    return GetParent()->template Retrieve< T >( name, directory, outputOnly );
00063 }
00064 
00065 template< class Type >
00066 template< class T >
00067 std::vector< T* > SToolBaseT< Type >::RetrieveAll( const char* name,
00068                                                    const char* directory ) throw( SError ) {
00069 
00070    return GetParent()->template RetrieveAll< T >( name, directory );
00071 }
00072 
00073 template< class Type >
00074 void SToolBaseT< Type >::WriteObj( const TObject& obj,
00075                                    const char* directory ) throw( SError ) {
00076 
00077    GetParent()->WriteObj( obj, directory );
00078    return;
00079 }
00080 
00081 template< class Type >
00082 TH1* SToolBaseT< Type >::Hist( const char* name, const char* dir ) {
00083 
00084    return GetParent()->Hist( name, dir );
00085 }
00086 
00087 template< class Type >
00088 template< typename T >
00089 bool SToolBaseT< Type >::ConnectVariable( const char* treeName, const char* branchName,
00090                                           T& variable ) throw ( SError ) {
00091 
00092    return GetParent()->template ConnectVariable( treeName, branchName, variable );
00093 }
00094 
00095 template< class Type >
00096 template< typename T >
00097 TBranch* SToolBaseT< Type >::DeclareVariable( T& obj, const char* name,
00098                                               const char* treeName ) throw( SError ) {
00099 
00100    return GetParent()->template DeclareVariable( obj, name, treeName );
00101 }
00102 
00103 template< class Type >
00104 TTree* SToolBaseT< Type >::GetMetadataTree( const char* name ) const throw( SError ) {
00105 
00106    return GetParent()->GetMetadataTree( name );
00107 }
00108 
00109 template< class Type >
00110 TTree* SToolBaseT< Type >::GetInputMetadataTree( const char* name ) const throw( SError ) {
00111 
00112    return GetParent()->GetInputMetadataTree( name );
00113 }
00114 
00115 template< class Type >
00116 TTree* SToolBaseT< Type >::GetOutputMetadataTree( const char* name ) const throw( SError ) {
00117 
00118    return GetParent()->GetOutputMetadataTree( name );
00119 }
00120 
00121 template< class Type >
00122 TTree* SToolBaseT< Type >::GetInputTree( const char* treeName ) const throw( SError ) {
00123 
00124    return GetParent()->GetInputTree( treeName );
00125 }
00126 
00127 template< class Type >
00128 TTree* SToolBaseT< Type >::GetOutputTree( const char* treeName ) const throw( SError ) {
00129 
00130    return GetParent()->GetOutputTree( treeName );
00131 }
00132 
00133 template< class Type >
00134 template< typename T >
00135 void SToolBaseT< Type >::DeclareProperty( const std::string& name, T& value ) {
00136 
00137    GetParent()->DeclareProperty( name, value );
00138    return;
00139 }
00140 
00141 template< class Type >
00142 void SToolBaseT< Type >::AddConfigObject( TObject* object ) {
00143 
00144    GetParent()->AddConfigObject( object );
00145    return;
00146 }
00147 
00148 template< class Type >
00149 TObject* SToolBaseT< Type >::GetConfigObject( const char* name ) const {
00150 
00151    return GetParent()->GetConfigObject( name );
00152 }
00153 
00154 template< class Type >
00155 void SToolBaseT< Type >::SetLogName( const char* name ) {
00156 
00157    m_logger.SetSource( name );
00158    return;
00159 }
00160 
00161 #endif // SFRAME_PLUGINS_SToolBase_ICC