ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/HafHistogram/interface/HHistogram.h
Revision: 1.1
Committed: Wed Sep 29 15:44:21 2010 UTC (14 years, 7 months ago) by yjlee
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
HafHistogram tool

File Contents

# User Rev Content
1 yjlee 1.1 #ifndef HHISTOGRAM_H
2     #define HHISTOGRAM_H
3    
4     /** \class HHistogram Ganzhur/HafHistogram/interface/HHistogram.h
5     *
6     * Description:
7     * Analysis code of the CMS experiment;
8     * Original version is a part of HAF package developed for CMS: UserCode/HAF
9     * Histogram class
10     *
11     * \author Marcel Kunze, Ruhr-University Bochum, Germany
12     * \author Serguei Ganjour, CEA-Saclay/IRFU, FR
13     *
14     * \version $Id: HHistogram.h,v 1.2 2009/11/19 09:40:31 ganzhur Exp $
15     *
16     */
17    
18     #include "TH1.h"
19     #include "TH2.h"
20    
21     class HCandList;
22     class HCandidate;
23    
24     class TObject;
25     class TH1;
26     class HHistID;
27    
28     class HHistogram : public TNamed {
29    
30     public:
31    
32     // Constructors:
33     // 1-D:
34     HHistogram( const char*, const char*, Int_t, Axis_t, Axis_t );
35     // 2-D:
36     HHistogram( const char*, const char*, Int_t, Axis_t, Axis_t, Int_t, Axis_t, Axis_t );
37     // Profile:
38     HHistogram( const char*, const char*, Int_t, Axis_t, Axis_t, Axis_t, Axis_t );
39    
40     // Destructor:
41     virtual ~HHistogram();
42    
43     // Functions to fill a histo:
44     void Accumulate( Axis_t, Stat_t weight= 1.0 );
45     void Accumulate1( Axis_t, Stat_t weight= 1.0 );
46     void Accumulate( Axis_t x, Axis_t y, Stat_t weight );
47     void Accumulate2( Axis_t, Axis_t, Stat_t weight= 1.0 );
48    
49     // clear all contents
50     void Reset();
51    
52     // accessors:
53     const char* Title() const { return GetTitle(); };
54     Float_t GetContents( Int_t, Int_t nbinsY= 0 ) const;
55    
56    
57     // error on a content of a bin
58     Float_t GetErrors( Int_t, Int_t nbinsY= 0 ) const;
59    
60    
61     // contents of a bin
62     Int_t GetEntries() const;
63     // total number of entries
64     Float_t GetWtSum() const;
65     // weighted sum
66     Int_t GetNbins( Int_t ) const;
67     // number of bins in a dimension
68     Float_t GetLow( Int_t ) const;
69     // low edge of a dimension
70     Float_t GetHigh( Int_t ) const;
71     // high edge of a dimension
72     Float_t GetAvg( Int_t ) const; // average X * wtsum
73     // average of theDim
74     Float_t GetCovar( Int_t, Int_t dim2= 0 ) const;
75     // covariance between the two dimensions
76     Int_t GetType() const;
77    
78     // Return the HHistID:
79     HHistID GetHistID() const;
80    
81     // Test if input pointer matches pointer to ROOT histo:
82     Bool_t PtrIsEqual( TObject* ptr ) const;
83    
84     HHistogram& operator<<(Axis_t x);
85    
86     // Extra functionality
87     void Fill( Axis_t x ) { Accumulate1(x); }
88     void Fill( Axis_t x, Axis_t y ) { Accumulate2(x,y); }
89     void SetFillColor(Color_t fcolor) { histp->SetFillColor(fcolor); }
90     virtual void Draw(Option_t *option="") { histp->Draw(option); }
91    
92     private:
93    
94     // Satisfy Scotts weird function
95     void setEntries( Int_t ) {};
96    
97    
98     // Data membrs:
99     TH1* histp;
100    
101     public:
102     ClassDef(HHistogram,1) //T histogram
103     };
104    
105     //----------------Spezialization-----------------
106    
107     class HMassHistogram : public HHistogram {
108    
109     public:
110     //Constructor
111     HMassHistogram(const Text_t *name,const Text_t *title,Int_t nbins,Axis_t xlow,Axis_t xup);
112     void Accumulate( Axis_t, Stat_t weight= 1.0 );
113     //Destructor
114     virtual ~HMassHistogram();
115     private:
116     public:
117     ClassDef(HMassHistogram,1) //Mass histogram
118     };
119    
120     class HEnergyHistogram : public HHistogram {
121    
122     public:
123     //Constructor
124     HEnergyHistogram(const Text_t *name,const Text_t *title,Int_t nbins,Axis_t xlow,Axis_t xup);
125     void Accumulate( Axis_t, Stat_t weight= 1.0 );
126     //Destructor
127     virtual ~HEnergyHistogram();
128     private:
129     public:
130     ClassDef(HEnergyHistogram,1) //Energy histogram
131     };
132    
133     class HMomentumHistogram : public HHistogram {
134    
135     public:
136     //Constructor
137     HMomentumHistogram(const Text_t *name,const Text_t *title,Int_t nbins,Axis_t xlow,Axis_t xup);
138     void Accumulate( Axis_t, Stat_t weight= 1.0 );
139     //Destructor
140     virtual ~HMomentumHistogram();
141     private:
142     public:
143     ClassDef(HMomentumHistogram,1) //Momentum histogram
144     };
145    
146     class HEoverPHistogram : public HHistogram {
147    
148     public:
149     //Constructor
150     HEoverPHistogram(const Text_t *name,const Text_t *title,Int_t nbinsx,Axis_t xlow,Axis_t xup
151     ,Int_t nbinsy,Axis_t ylow,Axis_t yup);
152     void Accumulate( Axis_t x, Axis_t y, Stat_t weight=1.0 );
153     //Destructor
154     virtual ~HEoverPHistogram();
155     private:
156     public:
157     ClassDef(HEoverPHistogram,1) //Energy vs. momentum histogram
158     };
159    
160     class HMoverPHistogram : public HHistogram {
161    
162     public:
163     //Constructor
164     HMoverPHistogram(const Text_t *name,const Text_t *title,Int_t nbinsx,Axis_t xlow,Axis_t xup
165     ,Int_t nbinsy,Axis_t ylow,Axis_t yup);
166     void Accumulate( Axis_t x, Axis_t y, Stat_t weight=1.0 );
167     //Destructor
168     virtual ~HMoverPHistogram();
169     private:
170     public:
171     ClassDef(HMoverPHistogram,1) //Mass vs. momentum histogram
172     };
173    
174     class HDalitzPlot : public HHistogram {
175    
176     public:
177     //Constructor
178     HDalitzPlot(const Text_t *name,const Text_t *title,Int_t nbinsx,Axis_t xlow,Axis_t xup
179     ,Int_t nbinsy,Axis_t ylow,Axis_t yup);
180     //Destructor
181     virtual ~HDalitzPlot();
182     private:
183     public:
184     ClassDef(HDalitzPlot,1) //Generate a Dalitz plot
185     };
186    
187     #endif
188