ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/include/BaseHists.h
Revision: 1.2
Committed: Fri May 17 10:14:53 2013 UTC (11 years, 11 months ago) by peiffer
Content type: text/plain
Branch: MAIN
CVS Tags: Makefile, v1-00, HEAD
Changes since 1.1: +15 -4 lines
Log Message:
changed inheritance for compatibility with new SFrame version

File Contents

# User Rev Content
1 rkogler 1.1 // Dear emacs, this is -*- c++ -*-
2     #ifndef BaseHists_H
3     #define BaseHists_H
4    
5     // STL include(s):
6     #include <map>
7     #include <string>
8    
9     // ROOT include(s):
10     #include <TObject.h>
11     #include <TString.h>
12 peiffer 1.2 #include <TList.h>
13 rkogler 1.1
14     // Local include(s):
15     //#include "include/ISCycleBaseHist.h"
16 peiffer 1.2 #include "include/SCycleBase.h"
17     //#include "include/SCycleBaseBase.h"
18 rkogler 1.1 #include "include/SError.h"
19    
20     // Forward declaration(s):
21     class TDirectory;
22     class TH1;
23     class TList;
24    
25     /**
26     * Base Class for the histogramming functionality
27     *
28     * Class which books and fills histograms. This class is a base
29     * class, all histogramming classes should inherit from it.
30     * The booking and naming of the histograms is taken care of
31     * through this class. Any derived class has to overwrite the
32     * Init, Fill and Finish methods.
33     * The derived objects have to be initialised in each
34     * SCycleBase::BeginInputData(...)
35     *
36 peiffer 1.2 * @version $Revision: 1.1 $
37 rkogler 1.1 */
38    
39 peiffer 1.2 class BaseHists : public SCycleBase {
40 rkogler 1.1
41    
42     public:
43     /// Named constructor
44     BaseHists(const char* name);
45    
46     /// Default destructor
47     ~BaseHists();
48    
49     virtual void Init() = 0;
50    
51     virtual void Fill() = 0;
52    
53     virtual void Finish() = 0;
54    
55     double* MakeLogBinning(int n_bins, double xmin, double xmax);
56    
57     TString GetName() {return m_name;}
58     void SetName(TString name) {m_name = name;}
59    
60 peiffer 1.2 // class has to inherit from SCycleBase to have access to histogram functionality in SFrame
61     // implement virtual routines but throw exception in case they are called
62     void BeginCycle()throw( SError ) { m_logger << ERROR << "This should not happen: BeginCycle called for BaseHist class" << SLogger::endmsg; } ;
63     void EndCycle()throw( SError ){ m_logger << ERROR << "This should not happen: EndCycle called for BaseHist class" << SLogger::endmsg; } ;
64     void BeginInputData(const SInputData&)throw( SError ){ m_logger << ERROR << "This should not happen: BeginInputData called for BaseHist class" << SLogger::endmsg; } ;
65     void EndInputData(const SInputData&)throw( SError ){ m_logger << ERROR << "This should not happen: EndInputData called for BaseHist class" << SLogger::endmsg; } ;
66     void BeginInputFile(const SInputData&)throw( SError ){ m_logger << ERROR << "This should not happen: BeginInputFile called for BaseHist class" << SLogger::endmsg; } ;
67     void ExecuteEvent(const SInputData&, Double_t)throw( SError ){ m_logger << ERROR << "This should not happen: ExecuteEvent called for BaseHist class" << SLogger::endmsg; } ;
68    
69    
70 rkogler 1.1 protected:
71     /// Function placing a ROOT object in the output file
72     template< class T > T* Book( const T& histo ) throw( SError );
73    
74     /// Function searching for a ROOT object in the output file
75     template< class T > T* Retrieve( const char* name ) throw( SError );
76    
77     /// Function for persistifying a ROOT object to the output
78     void WriteObj( const TObject& obj ) throw( SError );
79    
80     /// Function searching for 1-dimensional histograms in the output file
81     TH1* Hist( const char* name );
82    
83     private:
84     // private constructor, use the named one
85     BaseHists(){}
86    
87     TString m_name;
88    
89    
90     }; // class BaseHists
91    
92     // Don't include the templated function(s) when we're generating
93     // a dictionary:
94     #ifndef __CINT__
95     #include "BaseHists.icc"
96     #endif
97    
98    
99    
100     #endif // BaseHists_H