ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/include/BaseHists.h
Revision: 1.1
Committed: Tue Jun 5 14:52:43 2012 UTC (12 years, 11 months ago) by rkogler
Content type: text/plain
Branch: MAIN
CVS Tags: Feb-15-2013-v1, Feb-14-2013, Feb-07-2013-v1, Jan-17-2013-v2, Jan-17-2013-v1, Jan-16-2012-v1, Jan-09-2012-v2, Jan-09-2012-v1, Dec-26-2012-v1, Dec-20-2012-v1, Dec-17-2012-v1, Nov-30-2012-v2, Nov-30-2012-v1
Log Message:
new classes for easy variable access

File Contents

# Content
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
13 // Local include(s):
14 //#include "include/ISCycleBaseHist.h"
15 #include "include/SCycleBaseHist.h"
16 #include "include/SCycleBaseBase.h"
17 #include "include/SError.h"
18
19 // Forward declaration(s):
20 class TDirectory;
21 class TH1;
22 class TList;
23
24 /**
25 * Base Class for the histogramming functionality
26 *
27 * Class which books and fills histograms. This class is a base
28 * class, all histogramming classes should inherit from it.
29 * The booking and naming of the histograms is taken care of
30 * through this class. Any derived class has to overwrite the
31 * Init, Fill and Finish methods.
32 * The derived objects have to be initialised in each
33 * SCycleBase::BeginInputData(...)
34 *
35 * @version $Revision: 0 $
36 */
37
38 class BaseHists : public SCycleBaseHist {
39
40
41 public:
42 /// Named constructor
43 BaseHists(const char* name);
44
45 /// Default destructor
46 ~BaseHists();
47
48 virtual void Init() = 0;
49
50 virtual void Fill() = 0;
51
52 virtual void Finish() = 0;
53
54 double* MakeLogBinning(int n_bins, double xmin, double xmax);
55
56 TString GetName() {return m_name;}
57 void SetName(TString name) {m_name = name;}
58
59 protected:
60 /// Function placing a ROOT object in the output file
61 template< class T > T* Book( const T& histo ) throw( SError );
62
63 /// Function searching for a ROOT object in the output file
64 template< class T > T* Retrieve( const char* name ) throw( SError );
65
66 /// Function for persistifying a ROOT object to the output
67 void WriteObj( const TObject& obj ) throw( SError );
68
69 /// Function searching for 1-dimensional histograms in the output file
70 TH1* Hist( const char* name );
71
72 private:
73 // private constructor, use the named one
74 BaseHists(){}
75
76 TString m_name;
77
78
79 }; // class BaseHists
80
81 // Don't include the templated function(s) when we're generating
82 // a dictionary:
83 #ifndef __CINT__
84 #include "BaseHists.icc"
85 #endif
86
87
88
89 #endif // BaseHists_H