#ifndef _ptdrHistogramStyle_h_ #define _ptdrHistogramStyle_h_ #include "TStyle.h" #include "TString.h" #include "THStack.h" #include "TLegend.h" #include "TSystem.h" #include "TTree.h" #include "TFile.h" #include "TH1F.h" #include "TCanvas.h" #include "TColor.h" #include #include class TPTDRHistogramStyle: public THStack{ public: TPTDRHistogramStyle(bool colored=false); virtual ~TPTDRHistogramStyle() {}; /** Draw histograms. The method basically calls THStack::Draw(option). Possible values for option are "" and "nostack". */ virtual void DrawHistograms(TString option=""); /** It reads variableName from the treeName from the fileName and puts it to the array of histograms. lName is legend name for the histogram. nBins, min and max define the number of bins, maximal and minimal values for the X-axis(range). weight can be used when stacking histograms with different weights. */ TH1F* AddHistogram(TString variableName, TString fileName, TString lName, Int_t nBins=100, Double_t min=0, Double_t max=0, Double_t weight=1, TString treeName="T"); /** Create legend and draw it. */ void DrawLegend(); protected: /** Defines the hatching styles. */ vector hatchStyles; /** Number of histograms currently in the object. */ Int_t nHists; /** Minimal and maximal values for all histograms. */ Double_t min,max; TLegend * legend; vector legendNames; /** Black and white or colored. */ bool colored; public: ClassDef(TPTDRHistogramStyle,1); }; #endif