SFrame 3.6
core/include/SCycleBaseHist.h
Go to the documentation of this file.
00001 // Dear emacs, this is -*- c++ -*-
00002 // $Id: SCycleBaseHist.h 335 2012-11-21 14:11:47Z krasznaa $
00003 /***************************************************************************
00004  * @Project: SFrame - ROOT-based analysis framework for ATLAS
00005  * @Package: Core
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_CORE_SCycleBaseHist_H
00015 #define SFRAME_CORE_SCycleBaseHist_H
00016 
00017 // STL include(s):
00018 #include <map>
00019 #include <string>
00020 
00021 // ROOT include(s):
00022 #include <TObject.h>
00023 #include <TString.h>
00024 
00025 // Local include(s):
00026 #include "ISCycleBaseHist.h"
00027 #include "SCycleBaseBase.h"
00028 #include "SError.h"
00029 
00030 // Forward declaration(s):
00031 class TDirectory;
00032 class TH1;
00033 class TList;
00034 
00047 class SCycleBaseHist : public virtual ISCycleBaseHist,
00048                        public virtual SCycleBaseBase {
00049 
00050 public:
00052    SCycleBaseHist();
00053 
00055    virtual void SetHistOutput( TList* output );
00057    virtual TList* GetHistOutput() const;
00058 
00060    template< class T > T* Book( const T& histo,
00061                                 const char* directory = 0,
00062                                 Bool_t inFile = kFALSE ) throw( SError );
00064    template< class T > T* Retrieve( const char* name,
00065                                     const char* directory = 0,
00066                                     Bool_t outputOnly = kFALSE ) throw( SError );
00068    template< class T >
00069    std::vector< T* > RetrieveAll( const char* name,
00070                                   const char* directory = 0 ) throw( SError );
00072    void WriteObj( const TObject& obj,
00073                   const char* directory = 0,
00074                   Bool_t inFile = kFALSE ) throw( SError );
00075 
00077    TH1* Hist( const char* name, const char* dir = 0 ) throw( SError );
00078 
00079 protected:
00081    virtual void SetHistInputFile( TDirectory* file );
00083    virtual TDirectory* GetHistInputFile() const;
00084 
00086    virtual void WriteHistObjects( TDirectory* output );
00087 
00088 private:
00090    TDirectory* GetTempDir() const;
00091 
00092 #ifndef __MAKECINT__
00093 
00094    std::map< std::pair< std::string, std::string >, TH1* > m_histoMap;
00096    TList m_fileOutput;
00097 #endif // __MAKECINT__
00098 
00099    TList* m_proofOutput; 
00100    TDirectory* m_inputFile; 
00101 
00102 #ifndef DOXYGEN_IGNORE
00103    ClassDef( SCycleBaseHist, 0 );
00104 #endif // DOXYGEN_IGNORE
00105 
00106 }; // class SCycleBaseHist
00107 
00108 // Don't include the templated function(s) when we're generating
00109 // a dictionary:
00110 #ifndef __CINT__
00111 #include "SCycleBaseHist.icc"
00112 #endif
00113 
00114 #endif // SFRAME_CORE_SCycleBaseHist_H