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 TH1D* h, const Int_t lowbin=1, Int_t highbin=0) ;
|
29 |
|
30 |
//=====misc settings=====
|
31 |
void setDebug(bool debug) {debug_=debug;}
|
32 |
|
33 |
private:
|
34 |
void setLineColors(TString varname); //called by fillLegend()
|
35 |
TString getFullName(TString varname,TString sampleid);
|
36 |
|
37 |
//the TString is the sampleid
|
38 |
std::map< TString, TTree*> samples_;
|
39 |
std::map< TString, TString> sampleNames_;
|
40 |
std::map< TString, UInt_t> sampleColors_;
|
41 |
|
42 |
HistHolder * hh_;
|
43 |
bool debug_;
|
44 |
TString lastVarname_;
|
45 |
|
46 |
};
|
47 |
#endif
|