ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPlots/Plot/interface/PlotTask.h
Revision: 1.5
Committed: Wed Mar 28 12:10:21 2012 UTC (13 years, 1 month ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_029a, Mit_028, Mit_027, Mit_027a, HEAD
Changes since 1.4: +2 -2 lines
Log Message:
Small tweaks.

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: PlotTask.h,v 1.4 2011/12/11 19:22:29 bendavid Exp $
3 //
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 void SetNBins (UInt_t n) { fNBins = n; }
38 void SetDrawExp (const char* draw, const char* sel);
39
40 void SetPuTarget(const TH1D *h) { fPuTarget = h; }
41
42 static float PuWeight(Int_t npu);
43
44
45 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, bool rescale = kFALSE);
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 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 std::vector<TH1D*> fHists; // list of scaled histograms
78 std::vector<TH1D*> fStackedHists; // list of scaled histograms
79
80 const TH1D *fPuTarget;
81 static const TH1D *sPuWeights;
82
83 ClassDef(PlotTask, 0) // PlotTask plots analysis task with various options
84 };
85 }
86 #endif