ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPlots/Plot/interface/PlotTask.h
Revision: 1.3
Committed: Tue Feb 1 16:43:55 2011 UTC (14 years, 3 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.2: +6 -1 lines
Log Message:
add support for TTree and TTree Draw

File Contents

# User Rev Content
1 paus 1.2 //--------------------------------------------------------------------------------------------------
2 bendavid 1.3 // $Id: PlotTask.h,v 1.2 2011/01/25 11:30:30 paus Exp $
3 paus 1.2 //
4     // PlotTask
5     //
6     // This class implements PlotTask which allows to plot the samples with various options.
7     //
8     // Authors: C.Paus
9     //--------------------------------------------------------------------------------------------------
10    
11     #ifndef MITPLOTS_PLOT_PLOTTASK_H
12     #define MITPLOTS_PLOT_PLOTTASK_H
13    
14     #include <TH1D.h>
15     #include "MitPlots/Input/interface/TaskSamples.h"
16     #include "MitPlots/Style/interface/HistStyles.h"
17    
18     namespace mithep
19     {
20     class PlotTask
21     {
22     public:
23     PlotTask(const TaskSamples *taskSamples, const double lumi);
24     ~PlotTask();
25    
26     // Define histogram ranges
27     void SetHistMinimum (double min) { fHistMinimum = min; }
28     void SetHistMaximum (double max) { fHistMaximum = max; }
29     void SetHistXMinimum (double min) { fHistXMinimum = min; }
30     void SetHistXMaximum (double max) { fHistXMaximum = max; }
31     // Other plot parameters
32     void SetHistStyles (HistStyles *hS) { fHistStyles = hS; }
33     void SetAxisTitles (const char* xtit, const char* ytit = "Number of Events");
34     void SetXLegend (double x) { fXLegend = x; }
35     void SetYLegend (double y) { fYLegend = y; }
36     void SetNRebin (UInt_t n) { fNRebin = n; }
37 bendavid 1.3 void SetNBins (UInt_t n) { fNBins = n; }
38     void SetDrawExp (const char* draw, const char* sel);
39 paus 1.2
40     private:
41     // Overlay the contribution in a single histogram (no adding/stacking)
42     void PlotContributions(const char* dir, const char* hist);
43     void PlotStack (const char* dir, const char* hist);
44    
45     // Basic function to perfrom all reading and scaling operations
46     void ScaleHistograms (const char* dir, const char* hist);
47    
48     // Helper to set scale for a histogram
49     void FindHistMaximum ();
50     void OverlayFrame () const;
51     void OverlayEmptyHist () const;
52    
53     const TaskSamples *fTask; // analysis task to be plotted
54     HistStyles *fHistStyles; // style for plotting
55     const double fTargetLumi; // target luminosity for task
56    
57     UInt_t fIdxHistMax; // index of histogram with maximum entry
58     UInt_t fNRebin; // rebin parameter (default is 1)
59     TH1D* fEmptyHist; // empty identical histogram
60     TH1D* fDataHist; // data histogram if it exists
61     double fHistMinimum; // histogram maximum to be displayed
62     double fHistMaximum; // histogram minimum to be displayed
63     double fHistXMinimum; // histogram x-axis maximum to be displayed
64     double fHistXMaximum; // histogram x-axis minimum to be displayed
65     TString fAxisTitleX; // x axis title
66     TString fAxisTitleY; // y axis title
67     double fXLegend; // x position of upper left legend box
68     double fYLegend; // y position of upper left legend box
69 bendavid 1.3 UInt_t fNBins; // number of bins for TTree-derived histograms
70     TString fDrawExp; // draw expression for TTree::Draw
71     TString fSelExp; // selection expression for TTree::Draw
72 paus 1.2 std::vector<TH1D*> fHists; // list of scaled histograms
73     std::vector<TH1D*> fStackedHists; // list of scaled histograms
74    
75     ClassDef(PlotTask, 0) // PlotTask plots analysis task with various options
76     };
77     }
78     #endif