ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFramePlotter/RootPlotter.h
Revision: 1.1
Committed: Wed Jun 20 12:44:52 2012 UTC (12 years, 10 months ago) by rkogler
Content type: text/plain
Branch: MAIN
Log Message:
a generic plotter for data/MC comparisons

File Contents

# User Rev Content
1 rkogler 1.1 #ifndef ROOTPLOTTER_H
2     #define ROOTPLOTTER_H
3    
4     #include <TH1.h>
5     #include <THStack.h>
6     #include <TH2.h>
7     #include <TObjArray.h>
8     #include <TFile.h>
9     #include <TDirectory.h>
10     #include <TCanvas.h>
11     #include <TPostScript.h>
12    
13     class RootPlotter
14     {
15    
16     public:
17    
18     RootPlotter();
19     ~RootPlotter();
20    
21     // Open the Root files
22     void OpenRootFiles(TObjArray* filenames, const char* cyclename = 0);
23    
24     // Plotters
25     void PlotHistos(const char* psfilename);
26     void PlotYields(TH1* hist);
27    
28     // Utilities
29     void ShapeNormalize(TH1* hist);
30     void ShapeNormalize(THStack* stack);
31     TH1* MakePtFractionHisto(TH2D* in2dhist);
32     TH1* MakeJetShapeMeanHist(TH2D* in2dhist);
33     TH1* MakeMatchingEfficiencyHisto(TH2D* In2DHist);
34     TH1* GetSliceHisto(TH2D* In2DHist, Int_t bin);
35     TObjArray* FindSubdirs(TDirectory* dir);
36     void DrawPageNum(TCanvas* can, Int_t num);
37     TObjArray* GetPtBalanceHists();
38     TObjArray* GetResolutionHists();
39     TH1* StackHistograms(TString subdirname, TString histname);
40     TH1* BuildBackground(TString subdirname, TString histname);
41     TPostScript* MakeNewPsFile(const char* psfilename);
42     void MakeSubTitle(TH1* hist);
43     Bool_t ShouldBeStacked(const char* name);
44     void Cosmetics(TH1* hist, Int_t isample);
45     void CopyStyle(TH1& h1, TH1* h2);
46     void ApplyWeight(TH1* hist, Int_t isample);
47    
48     // Setters
49     void SetShapeNorm(Bool_t flag = true){bShapeNorm = flag;}
50     void SetPortraitMode(Bool_t flag = true){bPortrait = flag;}
51     void SetDrawEntries(Bool_t flag = true){bDrawEntries = flag;}
52     void PerformFit(Bool_t flag = true){bFitPtBalanceHists = flag;}
53     void SetJetShapesPerSlice(Bool_t flag = true){bJetShapesPerSlice = flag;}
54     void SetSubstractBkgd(Bool_t flag = true){bSubstractBkgd = flag;}
55     void SetPlotRatio(Bool_t flag=true){bPlotRatio = flag;}
56    
57     void SetSampleNames(TObjArray* SampleNames);
58     void SetHistColors(TArrayI colors);
59     void SetHistMarkers(TArrayI markers);
60     void SetSamplesToStack(TObjArray* names);
61     void SetSamplesWeight(TArrayF weights);
62    
63     private:
64    
65     TFile** fRootfiles; // the Rootfiles
66     Int_t fNumOfSamples; // how many chains should be plotted?
67    
68     TObjArray* fSampleNames; // the sample names
69    
70     TObjArray* fSamplesToStack; // the samples that should be stacked
71     Int_t fNumOfSamplesToStack; // number of samples to stack
72    
73     TArrayF fSamplesWeight; // weights of the chains
74     TArrayI fSampleColors; // colors of the chains
75     TArrayI fSampleMarkers; // markers of the chains
76    
77     Bool_t bShapeNorm; // use shape normalization
78     Bool_t bPortrait; // portrait or landscape mode
79     Bool_t bDrawEntries; // display the number of entries
80     Bool_t bFitPtBalanceHists; // perform fit of Pt-balance histograms?
81     Bool_t bJetShapesPerSlice; // perform fit of Pt-balance histograms?
82     Bool_t bSubstractBkgd; // substract background from the first chain?
83     Bool_t bPlotRatio; // should a ratio be plotted?
84    
85     };
86    
87     #endif // __JETANAPLOTTER_H