ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPlots/Plot/interface/PlotTask.h
Revision: 1.4
Committed: Sun Dec 11 19:22:29 2011 UTC (13 years, 5 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.3: +10 -2 lines
Log Message:
add pileup reweighting support per sample

File Contents

# User Rev Content
1 paus 1.2 //--------------------------------------------------------------------------------------------------
2 bendavid 1.4 // $Id: PlotTask.h,v 1.3 2011/02/01 16:43:55 bendavid 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 bendavid 1.4 void SetPuTarget(const TH1D *h) { fPuTarget = h; }
41    
42     static float PuWeight(Int_t npu);
43    
44    
45 paus 1.2 private:
46     // Overlay the contribution in a single histogram (no adding/stacking)
47     void PlotContributions(const char* dir, const char* hist);
48     void PlotStack (const char* dir, const char* hist);
49    
50     // Basic function to perfrom all reading and scaling operations
51     void ScaleHistograms (const char* dir, const char* hist);
52    
53     // Helper to set scale for a histogram
54     void FindHistMaximum ();
55     void OverlayFrame () const;
56     void OverlayEmptyHist () const;
57    
58     const TaskSamples *fTask; // analysis task to be plotted
59     HistStyles *fHistStyles; // style for plotting
60     const double fTargetLumi; // target luminosity for task
61    
62     UInt_t fIdxHistMax; // index of histogram with maximum entry
63     UInt_t fNRebin; // rebin parameter (default is 1)
64     TH1D* fEmptyHist; // empty identical histogram
65     TH1D* fDataHist; // data histogram if it exists
66     double fHistMinimum; // histogram maximum to be displayed
67     double fHistMaximum; // histogram minimum to be displayed
68     double fHistXMinimum; // histogram x-axis maximum to be displayed
69     double fHistXMaximum; // histogram x-axis minimum to be displayed
70     TString fAxisTitleX; // x axis title
71     TString fAxisTitleY; // y axis title
72     double fXLegend; // x position of upper left legend box
73     double fYLegend; // y position of upper left legend box
74 bendavid 1.3 UInt_t fNBins; // number of bins for TTree-derived histograms
75     TString fDrawExp; // draw expression for TTree::Draw
76     TString fSelExp; // selection expression for TTree::Draw
77 paus 1.2 std::vector<TH1D*> fHists; // list of scaled histograms
78     std::vector<TH1D*> fStackedHists; // list of scaled histograms
79 bendavid 1.4
80     const TH1D *fPuTarget;
81     static const TH1D *sPuWeights;
82    
83 paus 1.2 ClassDef(PlotTask, 0) // PlotTask plots analysis task with various options
84     };
85     }
86     #endif