ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/joshmt/PlotUtil.h
Revision: 1.1
Committed: Mon Mar 29 16:06:36 2010 UTC (15 years, 1 month ago) by joshmt
Content type: text/plain
Branch: MAIN
Log Message:
more mature plotting utilities

File Contents

# User Rev Content
1 joshmt 1.1 #ifndef _PlotUtil_h_
2     #define _PlotUtil_h_
3    
4     #include "TLegend.h"
5    
6     #include "HistHolder.h"
7    
8     class PlotUtil {
9     public :
10    
11     PlotUtil(HistHolder* hh);
12     virtual ~PlotUtil();
13    
14     //methods for doing the same thing to a bunch of samples
15     void addSample(TString sampleid,TTree* sampletree,TString sampleName="",UInt_t kcolor=1);
16     void createHistos(TString varname,int nbins, float hmin, float hmax) ;
17     //if drawcommand is empty, then varname is used
18     void fillHistos(TString varname, TString cut, TString drawcommand="");
19     // This function takes the histogram called _qcd and adds the _qcdnnn to it
20     void addQCD(TString varname);
21     //if no varname is specified, the last used varname is used
22     void fillLegend(TLegend * leg, TString varname="");
23     //will use whatever the current canvas is
24     void drawPlots(TString varname="");
25    
26     //======methods that calculate things======
27     //this is built in to later versions of ROOT, but not 5.22
28     Double_t ErrorOnIntegral(const TH1F* h, const Int_t lowbin, const Int_t highbin) ;
29    
30     //======misc utilities======
31     //gets rid of = > < from cuts in order to be better included in file names
32     TString fortranize(TString cut);
33    
34     //=====misc settings=====
35     void setDebug(bool debug) {debug_=debug;}
36    
37     private:
38     void setLineColors(TString varname); //called by fillLegend()
39     TString getFullName(TString varname,TString sampleid);
40    
41     //the TString is the sampleid
42     std::map< TString, TTree*> samples_;
43     std::map< TString, TString> sampleNames_;
44     std::map< TString, UInt_t> sampleColors_;
45    
46     HistHolder * hh_;
47     bool debug_;
48     TString lastVarname_;
49    
50     };
51     #endif