SFrame 3.6
|
00001 // Dear emacs, this is -*- c++ -*- 00002 // $Id: SToolBase.h 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_H 00015 #define SFRAME_PLUGINS_SToolBase_H 00016 00017 // SFrame include(s): 00018 #include "core/include/SLogger.h" 00019 #include "core/include/SCycleBase.h" 00020 00021 // Forward declaration(s): 00022 class TH1; 00023 class TObject; 00024 class TBranch; 00025 template< class T > class SInputVariables; 00026 template< class T > class SOutputVariables; 00027 00039 template< class Type > 00040 class SToolBaseT { 00041 00043 friend class SInputVariables< SToolBaseT< SCycleBase > >; 00045 friend class SOutputVariables< SToolBaseT< SCycleBase > >; 00047 friend class SToolBaseT< SToolBaseT< SCycleBase > >; 00048 00049 public: 00051 typedef Type ParentType; 00052 00054 SToolBaseT(); 00056 SToolBaseT( ParentType* parent ); 00058 virtual ~SToolBaseT() {} 00059 00061 ParentType* GetParent() const; 00063 void SetParent( ParentType* parent ); 00064 00065 protected: 00067 // // 00068 // Functions inherited from SCycleBaseHist // 00069 // // 00071 00073 template< class T > T* Book( const T& histo, 00074 const char* directory = 0 ) throw( SError ); 00076 template< class T > T* Retrieve( const char* name, 00077 const char* directory = 0, 00078 Bool_t outputOnly = kFALSE ) throw( SError ); 00080 template< class T > 00081 std::vector< T* > RetrieveAll( const char* name, 00082 const char* directory = 0 ) throw( SError ); 00084 void WriteObj( const TObject& obj, 00085 const char* directory = 0 ) throw( SError ); 00087 TH1* Hist( const char* name, const char* dir = 0 ); 00088 00090 // // 00091 // Functions inherited from SCycleBaseNTuple // 00092 // // 00094 00096 template< typename T > 00097 bool ConnectVariable( const char* treeName, const char* branchName, 00098 T& variable ) throw ( SError ); 00100 template< typename T > 00101 TBranch* DeclareVariable( T& obj, const char* name, 00102 const char* treeName = 0 ) throw( SError ); 00104 virtual TTree* GetMetadataTree( const char* name ) const throw( SError ); 00106 virtual TTree* GetInputMetadataTree( const char* name ) const throw( SError ); 00108 virtual TTree* GetOutputMetadataTree( const char* name ) const throw( SError ); 00110 virtual TTree* GetInputTree( const char* treeName ) const throw( SError ); 00112 virtual TTree* GetOutputTree( const char* treeName ) const throw( SError ); 00113 00115 // // 00116 // Functions inherited from SCycleBaseConfig // 00117 // // 00119 00121 template< typename T > 00122 void DeclareProperty( const std::string& name, T& value ); 00124 void AddConfigObject( TObject* object ); 00126 TObject* GetConfigObject( const char* name ) const; 00127 00129 // // 00130 // The class's own functions // 00131 // // 00133 00135 void SetLogName( const char* name ); 00136 00137 protected: 00138 mutable SLogger m_logger; 00139 00140 private: 00141 ParentType* m_parent; 00142 00143 }; // class SToolBaseT 00144 00145 // Include the template implementation: 00146 #ifndef __CINT__ 00147 #include "SToolBase.icc" 00148 #endif // __CINT__ 00149 00151 00160 typedef SToolBaseT< SCycleBase > SToolBase; 00161 00162 #endif // SFRAME_PLUGINS_SToolBase_H