ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/src/BaseHists.cxx
Revision: 1.1
Committed: Tue Jun 5 14:53:54 2012 UTC (12 years, 11 months ago) by rkogler
Content type: text/plain
Branch: MAIN
CVS Tags: Makefile, v1-00, 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, HEAD
Log Message:
new classes for easy variable access

File Contents

# User Rev Content
1 rkogler 1.1 #include <cmath>
2     #include "include/BaseHists.h"
3    
4     BaseHists::BaseHists(const char* name)
5     {
6     // named constructor
7     m_name = name;
8     SetLogName("BaseHists_" + m_name);
9     }
10    
11     BaseHists::~BaseHists()
12     {
13     // default destructor, does nothing
14     }
15    
16     void BaseHists::WriteObj( const TObject& obj ) throw( SError ) {
17    
18     SCycleBaseHist::WriteObj( obj, m_name.Data() );
19     return;
20     }
21    
22    
23     TH1* BaseHists::Hist( const char* name ) {
24    
25     TH1* his = SCycleBaseHist::Hist( name, m_name.Data() );
26     return his;
27     }
28    
29    
30    
31     double* BaseHists::MakeLogBinning(int n_bins, double xmin, double xmax)
32     {
33     // return pointer to an array of bins in logscale
34     // usage: Double_t* ptbins = MakeLogBinning(50,100,2000.);
35     // ... TH1F("Pt","Jet PT", 50, ptbins);
36    
37     double *binning = new double[n_bins+1];
38    
39     double delta_x_log = (log(xmax)-log(xmin))/n_bins;
40    
41     binning[0]=xmin;
42     // put equidistant binwidth on a logarithmic scale
43     for(int i=1;i<=n_bins;++i){
44     binning[i] = exp(log(binning[i-1])+ delta_x_log);
45     }
46     return binning;
47     }